François Pinard pinard at
Mon Sep 4 20:01:20 CEST 2000

[Gareth McCaughan]

> A concrete suggestion, if you really do need good asymptotics: use a
> heap. One way to think about (and implement) a heap is as an array of
> elements for which it's always true that a[i] <= a[(i-1)/2] where "/"
> means integer division, as in Python. Then you can define the following
> stuff (WARNING: untested code ahead...)

A while ago, I published similar code on the Python list, tested.  I should
have put it somewhere on the Web, but not yet.  Anybody curious, just ask.

François Pinard

More information about the Python-list mailing list