|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object structure.SkewHeap
public class SkewHeap
An implementation of a priority queue using skew heaps. Skew heaps allow one to construct heaps dynamically without explictly balancing the heaps. Main operation is a merge.
Constructor Summary | |
---|---|
SkewHeap()
Constructs an empty priority queue. |
Method Summary | |
---|---|
void |
add(Comparable value)
Add a value to the priority queue. |
void |
clear()
Remove all the elements from the queue. |
Comparable |
getFirst()
Fetch lowest valued (highest priority) item from queue. |
boolean |
isEmpty()
Determine if the queue is empty. |
Comparable |
remove()
Returns the minimum value from the queue. |
int |
size()
Determine the size of the queue. |
String |
toString()
Construct a string representation of the heap. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SkewHeap()
Method Detail |
---|
public Comparable getFirst()
getFirst
in interface PriorityQueue
public Comparable remove()
remove
in interface PriorityQueue
public void add(Comparable value)
add
in interface PriorityQueue
value
- The value to be added.public int size()
size
in interface PriorityQueue
public void clear()
clear
in interface PriorityQueue
public boolean isEmpty()
isEmpty
in interface PriorityQueue
public String toString()
toString
in class Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |