import numpy as np tl = (np.array(np.random.rand(20)*100,dtype=int)) def triInsertion(l): out = [] for e in l: toadd = e nout = [] for i in range(len(out)): if out[i]>=toadd: nout.append(toadd) toadd=out[i] else: nout.append(out[i]) nout.append(toadd) out = nout return out def triFusionRec(l): if len(l)==0: return l if len(l)==1: return l n = len(l)//2 l1,l2 = triFusionRec(l[:n]),triFusionRec(l[n:]) out = [] i,j = 0,0 while i=len(l2) or (i