Hi,
I'd like to get the biggest 100 elements out from 100000000 numbers(may be more) in a list.
So I don't want to do a sort and pick up the first 100 elements to avoid memory issue. Sorting will consume much memory and time.
Any existing choice?
What I want is following function instead of a pure sort. Actually I don't want waste time to sort the elements I don't care.
For example, this is the function I'd like to have:
getSortedElements(100, lambda x,y:cmp(x,y))
Note this requirement is only for performance perspective.