Commit Graph

57 Commits

Author SHA1 Message Date
Tim Peters 28c25527c2 Hmm! I thought I checked this in before! Oh well.
Added new heapify() function, which transforms an arbitrary list into a
heap in linear time; that's a fundamental tool for using heaps in real
life <wink>.

Added heapyify() test.  Added a "less naive" N-best algorithm to the test
suite, and noted that this could actually go much faster (building on
heapify()) if we had max-heaps instead of min-heaps (the iterative method
is appropriate when all the data isn't known in advance, but when it is
known in advance the tradeoffs get murkier).
2002-08-02 21:48:06 +00:00
Guido van Rossum 4b48d6b37c Add a PEP-263-style encoding turd^H^H^H^Hdeclaration, because there's
a c-cedilla in one of the docstrings.
2002-08-02 20:23:56 +00:00
Tim Peters 62abc2f6ce heappop(): Added comments; simplified and sped the code. 2002-08-02 20:09:14 +00:00
Tim Peters a0b3a00bc5 heappop(): Use "while True" instead of "while 1". 2002-08-02 19:45:37 +00:00
Tim Peters d9ea39db84 Don't use true division where int division was intended. For that matter,
don't use division at all.
2002-08-02 19:16:44 +00:00
Guido van Rossum 37c3b2788b Add Kevin O'Connor, author of the heapq code. 2002-08-02 16:50:58 +00:00
Guido van Rossum 0a82438859 Adding the heap queue algorithm, per discussion in python-dev last
week.
2002-08-02 16:44:32 +00:00