Method: CompSci::Heap#heapish?

Defined in:
lib/compsci/heap.rb

#heapish?(pidx, cidx) ⇒ Boolean

are values of parent and child (by index) in accordance with heap property?

Returns:

  • (Boolean)


95
96
97
# File 'lib/compsci/heap.rb', line 95

def heapish?(pidx, cidx)
  (@array[pidx] <=> @array[cidx]) != (@cmp_val * -1)
end