K - the type of keys maintained by this heapV - the type of values maintained by this heappublic interface AddressableHeap<K,V>
AddressableHeap.Handle which can later
be used in order to manipulate the element, such as decreasing its key, or
deleting it. Storing the handle externally is the responsibility of the user.| Modifier and Type | Interface and Description |
|---|---|
static interface |
AddressableHeap.Handle<K,V>
A heap element handle.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear all the elements of the heap.
|
Comparator<? super K> |
comparator()
Returns the comparator used to order the keys in this AddressableHeap, or
null if this heap uses the natural
ordering of its keys. |
AddressableHeap.Handle<K,V> |
deleteMin()
Delete and return an element with the minimum key.
|
AddressableHeap.Handle<K,V> |
findMin()
Find an element with the minimum key.
|
AddressableHeap.Handle<K,V> |
insert(K key)
Insert a new element into the heap with a null value.
|
AddressableHeap.Handle<K,V> |
insert(K key,
V value)
Insert a new element into the heap.
|
boolean |
isEmpty()
Returns
true if this heap is empty. |
long |
size()
Returns the number of elements in the heap.
|
Comparator<? super K> comparator()
null if this heap uses the natural
ordering of its keys.null if this addressable heap uses the natural ordering
of its keysAddressableHeap.Handle<K,V> insert(K key, V value)
key - the element's keyvalue - the element's valueAddressableHeap.Handle<K,V> insert(K key)
key - the element's keyAddressableHeap.Handle<K,V> findMin()
AddressableHeap.Handle<K,V> deleteMin()
AddressableHeap.Handle.getKey()
and AddressableHeap.Handle.getValue() can be used.boolean isEmpty()
true if this heap is empty.true if this heap is empty, false otherwiselong size()
void clear()
AddressableHeap.Handle.decreaseKey(Object) and AddressableHeap.Handle.delete() is
undefined.Copyright © 2018. All rights reserved.