Skip to content

Commit

Permalink
Heap#consolidate: Use compare_fn instead of #==
Browse files Browse the repository at this point in the history
Fix #23.
  • Loading branch information
bcc32 committed Dec 30, 2023
1 parent d8834b2 commit b59e02d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/containers/heap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,8 @@ def consolidate
degree += 1
end
degrees[degree] = root
min = root if min.key == root.key # this fixes a bug with duplicate keys not being in the right order

min = root if !@compare_fn[min.key, root.key] # this fixes a bug with duplicate keys not being in the right order
end
end
@next = min
Expand Down

0 comments on commit b59e02d

Please sign in to comment.