Class: Heap::Min

Inherits:
Heap show all
Defined in:
lib/mega/heap.rb

Overview

Keeps an heap sorted with the smallest element on top

Instance Method Summary collapse

Methods inherited from Heap

inherited, #pop, #push, #push_all, #size, #sort, #sort_internal, #to_s, #top

Constructor Details

#initialize(array = []) ⇒ Min

Returns a new instance of Min.



83
# File 'lib/mega/heap.rb', line 83

def initialize(array=[]) super(array) end

Instance Method Details

#cmp(a, b) ⇒ Object



85
# File 'lib/mega/heap.rb', line 85

def cmp(a,b) a < b end