On 22/10/09 15:31, Paul Johnson wrote:

>  takeLargest k = take k . sort

Because "sort" is lazily evaluated this only does enough sorting to find the first k elements. I guess the complexity is something like O(n*k*log(k)).

Correction: O(n*log(k))
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to