Skip to content

Commit 9bb0b6c

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

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/containers/heap.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ 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+
min = root if !@compare_fn[min.key, root.key] # this fixes a bug with duplicate keys not being in the right order
373373
end
374374
end
375375
@next = min

0 commit comments

Comments
 (0)