On Jun 22, 2009, at 11:36 PM, Christophe Grand wrote: > Selecting the top N out of n items is a O(n*sqrt(N)) operation so > it's linear when n dominates N and thus must beat take + sort. Plus > it won't retain the whole realized seq in memory.
Just because I'm curious, I can see how to do max in O(N) time, so I can see how to do top-n in O(n*N) ≈ O(N) time, but I don't see how to do that in sqrt(N) time. What's this algorithm called or how does it work? — Daniel Lyons --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---