Double-Ended Heaps

Bryan Olson fakeaddress at
Mon Dec 19 08:26:03 CET 2005

Scott David Daniels wrote:
> I've just put together a Double-Ended Heap package.
> Of course I'd love comments.

I think there's a typo in:

     Note that any change to the contents of a DeHeap (and
     therefore a DeHeap2) any re-arrange the indices of a
     number of entries in the DeHeap.

A useful Python class will follow Python convention, where
relevant convention exists. In this case that means optionally
passing the ordering relation; look at sort() and sorted().

Adopting the convention will raises another issue: distinct
objects can compare as equal, so the DeHeap2 operations that
find items by value will be at least under-defined, and maybe
even broken. There are several ways to solve the problem, and
I don't know of Python convention as to which to choose.


More information about the Python-list mailing list