On Fri, Jul 27, 2001 at 12:13:45AM -0400, Andrew Pimlott wrote:
> On Thu, Jul 26, 2001 at 03:06:38AM -0700, Abigail wrote:
> > We all remember our fundamental algorithms, don't we?
> 
> Not really, which is why it's good to have you remind us :-)
> Now that you mention it, though,
> 
> > sub heapify ($$$$) {
> >     my ($code, $index, $array, $bound) = @_;
> >     {
> >         my $child = 2 * $index;
> 
> that heap looks a bit funny.  I think you meant
> 
>           my $child = 2 * $index + 1;

Eh, right.

> (The original works, by chance.)

Nah, not by chance. It works fine. It's just that the top element of
the heap only has one child - but that doesn't matter for the algorithm
to work. ;-)


Abigail

Reply via email to