in reply to Re: Re: Re: looking for a Priority Queue
in thread looking for a Priority Queue
Actually if you RTFS a little more carefully you will see that 1) it never sorts the list (ever) 2) the only thing that gets sorted is the priorities array (which consists only of the n priority levels present) and 3) the only time it does this sort is when either a new (previously unknown) priority level is added or a priority level needs to be deleted as there are no more items of this priority present in the heap. It checks for the presence of a priority level via a hash key (rather than searching the whole priority array as a further speed hack.....
sub add { # blah unless (exists $self->{'.queue'}->{$priority}) { $self->{'.queue'}->{$priority} = (); $self->_sort_priorities; }
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Re: Re: Re: looking for a Priority Queue
by educated_foo (Vicar) on May 07, 2002 at 08:44 UTC | |
by tachyon (Chancellor) on May 07, 2002 at 14:22 UTC | |
by educated_foo (Vicar) on May 07, 2002 at 16:08 UTC |