Class comb.collections.Heap
Extends
comb.collections.Collection.
Defined in: Heap.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Base class for Heap Implementations.
|
Field Attributes | Field Name and Description |
---|---|
the current number of elements.
|
|
true if the Heap is empty.
|
|
the keys of all items in the heap.
|
|
the values contained in the heap.
|
Method Attributes | Method Name and Description |
---|---|
clear()
Empty the heap.
|
|
containsKey(key)
Determine if the heap contains a particular key.
|
|
containsValue(value)
Determine if the heap contains a particular value.
|
|
insert(key, value)
Insert a key value into the key
|
|
peek()
Gets he value of the root node with out removing it.
|
|
peekKey()
Gets the key of the root node without removing it.
|
|
print()
Print the heap.
|
|
remove()
Removes the root from the heap
|
- Methods borrowed from class comb.collections.Collection:
- concat, indexOf, join, lastIndexOf, slice, toString
Field Detail
{Number}
count
the current number of elements.
{Boolean}
isEmpty
true if the Heap is empty.
{Array}
keys
the keys of all items in the heap.
{Array}
values
the values contained in the heap.
Method Detail
clear()
Empty the heap.
{Boolean}
containsKey(key)
Determine if the heap contains a particular key.
- Parameters:
- key
- key to test.
- Returns:
- {Boolean} true if the key is contained in this heap.
{Boolean}
containsValue(value)
Determine if the heap contains a particular value.
- Parameters:
- value
- value to test.
- Returns:
- {Boolean} true if the value is contained in this heap.
insert(key, value)
Insert a key value into the key
- Parameters:
- key
- value
peek()
Gets he value of the root node with out removing it.
- Returns:
- the value of the root
peekKey()
Gets the key of the root node without removing it.
- Returns:
- the key of the root
print()
Print the heap.
remove()
Removes the root from the heap
- Returns:
- the value of the root