The stupid question is the question not asked | |
PerlMonks |
Re: Better mousetrap (getting top N values from list X)by sleepingsquirrel (Chaplain) |
on Feb 03, 2005 at 21:12 UTC ( [id://427825]=note: print w/replies, xml ) | Need Help?? |
Just as an aside, if you had lazy lists (coming in perl6) and the appropriate sort, the following should run in optimal O(X*log(N)) time, straight out of the box.
-- All code is 100% tested and functional unless otherwise noted.
In Section
Seekers of Perl Wisdom
|
|