Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re^7: Heap sorting in perl

by adrianh (Chancellor)
on Apr 05, 2003 at 20:12 UTC ( #248334=note: print w/replies, xml ) Need Help??

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

I was proposing to solve the problem originally stated. I thought that my description of how to solve it using a heap was fairly clear on that point by telling you when to start removing elements while still adding them.

I know. Just misinterpreted it. Sorry. One of my many moments of stupidity ;-)

I agree that until N is large (causing, eg, memory problems) or the comparison function is expensive, using sort will be faster. The heap solution outlined is helpful only for large N.

A good XS heap implementation would still win over sort with small N. It's just a C vs Perl issue speedwise.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://248334]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2018-07-16 12:51 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (334 votes). Check out past polls.