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.zigans...@gmail.com

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to