Commit ca38cb41 authored by Guido van Rossum's avatar Guido van Rossum

Fix _union() -- it wasn't getting what it expected from pop_smallest()

inside the while loop either.
parent 59b09255
...@@ -177,8 +177,8 @@ class Index: ...@@ -177,8 +177,8 @@ class Index:
merge.add((x, weight), len(x)) merge.add((x, weight), len(x))
while len(merge) > 1: while len(merge) > 1:
# Merge the two smallest so far, and add back to the queue. # Merge the two smallest so far, and add back to the queue.
x, wx = merge.pop_smallest() (x, wx), dummy = merge.pop_smallest()
y, wy = merge.pop_smallest() (y, wy), dummy = merge.pop_smallest()
dummy, z = weightedUnion(x, y, wx, wy) dummy, z = weightedUnion(x, y, wx, wy)
merge.add((z, 1), len(z)) merge.add((z, 1), len(z))
(result, weight), score = merge.pop_smallest() (result, weight), score = merge.pop_smallest()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment