
23 Jun
2010
23 Jun
'10
6:33 a.m.
Hello ajb, Wednesday, June 23, 2010, 6:58:30 AM, you wrote:
build ((w1,t1):(w2,t2):wts) = build $ insertBy (comparing fst) (w1+w2, Node t1 t2) wts
this algo is O(n^2). to be O(n) you should handle separate lists of leafs and nodes, adding new nodes to the tail of second list -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com