Package se.umu.cs.aj.heap
Class BinaryHeap<O,W extends java.lang.Comparable<W>>
- java.lang.Object
-
- se.umu.cs.aj.heap.BinaryHeap<O,W>
-
public class BinaryHeap<O,W extends java.lang.Comparable<W>> extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
BinaryHeap.Node
-
Field Summary
Fields Modifier and Type Field Description static int
firstPosition
-
Constructor Summary
Constructors Constructor Description BinaryHeap()
BinaryHeap(boolean isMinHeap)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BinaryHeap.Node
add(O object, W weight)
BinaryHeap.Node
addUnordered(O object, W weight)
BinaryHeap.Node
createNode(O object)
void
decreaseWeight(BinaryHeap.Node node, W newWeight)
BinaryHeap.Node
dequeue()
boolean
empty()
BinaryHeap.Node
insert(BinaryHeap.Node node, W weight)
BinaryHeap.Node
insertUnordered(BinaryHeap.Node node, W weight)
void
makeHeap()
BinaryHeap.Node
peek()
void
printHeap()
int
size()
-
-
-
Field Detail
-
firstPosition
public static final int firstPosition
- See Also:
- Constant Field Values
-
-
Method Detail
-
size
public int size()
-
empty
public boolean empty()
-
peek
public BinaryHeap.Node peek()
-
add
public BinaryHeap.Node add(O object, W weight)
-
addUnordered
public BinaryHeap.Node addUnordered(O object, W weight)
-
createNode
public BinaryHeap.Node createNode(O object)
-
insertUnordered
public BinaryHeap.Node insertUnordered(BinaryHeap.Node node, W weight)
-
insert
public BinaryHeap.Node insert(BinaryHeap.Node node, W weight)
-
makeHeap
public void makeHeap()
-
decreaseWeight
public void decreaseWeight(BinaryHeap.Node node, W newWeight)
-
dequeue
public BinaryHeap.Node dequeue()
-
printHeap
public void printHeap()
-
-