Class: Heap::Max

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

Overview

Keeps an heap sorted with the largest 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 = []) ⇒ Max

Returns a new instance of Max.



59
# File 'lib/carat/heap.rb', line 59

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

Instance Method Details

#cmp(a, b) ⇒ Object



61
# File 'lib/carat/heap.rb', line 61

def cmp(a,b) a > b end