public class BinaryHeap<T extends BinaryHeap.Node> extends Object
Modifier and Type | Class and Description |
---|---|
static class |
BinaryHeap.Node |
Modifier and Type | Field and Description |
---|---|
int |
size |
Constructor and Description |
---|
BinaryHeap() |
BinaryHeap(int capacity,
boolean isMaxHeap) |
Modifier and Type | Method and Description |
---|---|
T |
add(T node) |
T |
add(T node,
float value) |
void |
clear() |
boolean |
contains(T node,
boolean identity)
Returns if binary heap contains the provided node.
|
boolean |
equals(Object obj) |
int |
hashCode() |
boolean |
isEmpty()
Returns true if the heap is empty.
|
T |
peek() |
T |
pop() |
T |
remove(T node) |
void |
setValue(T node,
float value) |
String |
toString() |
public BinaryHeap()
public BinaryHeap(int capacity, boolean isMaxHeap)
public boolean contains(T node, boolean identity)
node
- May be null.identity
- If true, == comparison will be used. If false, .equals() comparison will be used.public T peek()
public T pop()
public boolean isEmpty()
public void clear()
public void setValue(T node, float value)
Copyright © 2018. All rights reserved.