When you are done you can then just extract off all of the elements in the heap, and you have the smallest N of them from largest to smallest. Without excessive memory usage.
In reply to Re: Re: Heap sorting in perl
by Anonymous Monk
in thread Heap sorting in perl
by blakem
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |