From 9bb0b6c6abb702930d01353abc11da08edd0362e Mon Sep 17 00:00:00 2001 From: "Aaron L. Zeng" Date: Sat, 30 Dec 2023 00:20:59 -0500 Subject: [PATCH] Heap#consolidate: Use compare_fn instead of #== Fix #23. --- lib/containers/heap.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/containers/heap.rb b/lib/containers/heap.rb index 0473e218..5c6a7c87 100644 --- a/lib/containers/heap.rb +++ b/lib/containers/heap.rb @@ -369,7 +369,7 @@ 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