class Algorithmable::Cups::StacksAndQueues::StackWithMin
Constants
- MAX_INT
- NodeWithMin
Public Instance Methods
min()
click to toggle source
# File lib/algorithmable/cups/stacks_and_queues/stack_with_min.rb, line 16 def min return MAX_INT if empty? peek.min end
push(item)
click to toggle source
Calls superclass method
Algorithmable::DataStructs::Stack#push
# File lib/algorithmable/cups/stacks_and_queues/stack_with_min.rb, line 10 def push(item) new_min = [item, min].min node = NodeWithMin.new item, new_min super node end