Skip to content

Commit

Permalink
Merge pull request kanwei#49 from BMorearty/fix-push-performance
Browse files Browse the repository at this point in the history
Fix `push` to be O(1) as promised.
  • Loading branch information
kanwei authored Nov 10, 2023
2 parents 5926f80 + 80652da commit b612097
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions lib/containers/heap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,6 @@ def push(key, value=key)
end
@size += 1

arr = []
w = @next.right
until w == @next do
arr << w.value
w = w.right
end
arr << @next.value
@stored[key] ||= []
@stored[key] << node
value
Expand Down

0 comments on commit b612097

Please sign in to comment.