|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectstructure.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 PriorityQueuepublic Comparable remove()
remove in interface PriorityQueuepublic void add(Comparable value)
add in interface PriorityQueuevalue - The value to be added.public int size()
size in interface PriorityQueuepublic void clear()
clear in interface PriorityQueuepublic boolean isEmpty()
isEmpty in interface PriorityQueuepublic String toString()
toString in class Object
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||