End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
SyntaxSuggest::PriorityQueue#bubble_down
bubble_down(index)
lib/syntax_suggest/priority_queue.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.2.0/lib/syntax_suggest/priority_queue.rb, line 81
def bubble_down(index)
child_index = (index * 2) + 1
return if child_index > last_index
not_the_last_element = child_index < last_index
left_element = @elements[child_index]
right_element = @elements[child_index + 1]
child_index += 1 if not_the_last_element && (right_element <=> left_element) == 1
return if (@elements[index] <=> @elements[child_index]) >= 0
exchange(index, child_index)
bubble_down(child_index)
end
No documentation available