in reply to Re^5: Heap sorting in perl
in thread Heap sorting in perl

Abigail's original solution as I read it requires that the entire dataset of size N be passed into the function smallest(). This requires that you have enough memory for N things up front. Which is the original poster's problem, he doesn't. He only comfortably has room for M things, but is fetching through a much larger dataset of N.

Abigail's follow-up solution resolves this limitation admirably well...