A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-July/026869.html below:

[Python-Dev] Priority queue (binary heap) python code

[Python-Dev] Priority queue (binary heap) python code [Python-Dev] Priority queue (binary heap) python codeDelaney, Timothy tdelaney@avaya.com
Mon, 22 Jul 2002 09:40:24 +1000
> From: Kevin O'Connor [mailto:kevin@koconnor.net]
> On Sat, Jul 20, 2002 at 02:06:29AM -0400, Guido van Rossum wrote:
> 
> >The only change I would make would be to make heap[0] the
> > lowest value rather than the highest.
> 
> I agree this appears more natural, but a priority queue that pops the
> lowest priority item is a bit odd.

I'm in two minds about this. My first thought is that the *first* item
(heap[0]) should be the highest priority.

OTOH, if it were a sorted list, list[0] would return the *lowest* priority.

So i think for consistency heap[0] must return the lowest priority.

Tim Delaney




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4