Skip to content

Commit b59e02d

Browse files
committed
Heap#consolidate: Use compare_fn instead of #==
Fix #23.
1 parent d8834b2 commit b59e02d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/containers/heap.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,8 @@ def consolidate
369369
degree += 1
370370
end
371371
degrees[degree] = root
372-
min = root if min.key == root.key # this fixes a bug with duplicate keys not being in the right order
372+
373+
min = root if !@compare_fn[min.key, root.key] # this fixes a bug with duplicate keys not being in the right order
373374
end
374375
end
375376
@next = min

0 commit comments

Comments
 (0)