class Priorityq::PriorityQueue
Attributes
heap[R]
Public Class Methods
max()
click to toggle source
# File lib/priorityq/priority_queue.rb, line 18 def self.max new end
min()
click to toggle source
# File lib/priorityq/priority_queue.rb, line 22 def self.min new Priorityq::Heap.min end
new(heap = Priorityq::Heap.max)
click to toggle source
# File lib/priorityq/priority_queue.rb, line 26 def initialize(heap = Priorityq::Heap.max) @heap = heap end
Public Instance Methods
empty?()
click to toggle source
# File lib/priorityq/priority_queue.rb, line 30 def empty? heap.empty? end
peek()
click to toggle source
# File lib/priorityq/priority_queue.rb, line 34 def peek peek_element&.value end
peek_element()
click to toggle source
# File lib/priorityq/priority_queue.rb, line 38 def peek_element heap.peek end
pop()
click to toggle source
# File lib/priorityq/priority_queue.rb, line 42 def pop pop_element&.value end
pop_element()
click to toggle source
# File lib/priorityq/priority_queue.rb, line 46 def pop_element heap.pop end
push(priority, value)
click to toggle source
# File lib/priorityq/priority_queue.rb, line 50 def push(priority, value) heap.push Element.new(priority, value) end