All Packages Class Hierarchy This Package Previous Next Index
Class DataStructures.LeftistHeap
java.lang.Object
|
+----DataStructures.LeftistHeap
- public class LeftistHeap
- extends Object
Implements a leftist heap.
Note that all "matching" is based on the compareTo method.
LeftistHeap()
- Construct the leftist heap.
deleteMin()
- Remove the smallest item from the priority queue.
findMin()
- Find the smallest item in the priority queue.
insert(Comparable)
- Insert into the priority queue, maintaining heap order.
isEmpty()
- Test if the priority queue is logically empty.
isFull()
- Test if the priority queue is logically full.
main(String[])
-
makeEmpty()
- Make the priority queue logically empty.
merge(LeftistHeap)
- Merge rhs into the priority queue.
LeftistHeap
public LeftistHeap()
- Construct the leftist heap.
merge
public void merge(LeftistHeap rhs)
- Merge rhs into the priority queue.
rhs becomes empty. rhs must be different from this.
- Parameters:
- rhs - the other leftist heap.
insert
public void insert(Comparable x)
- Insert into the priority queue, maintaining heap order.
- Parameters:
- x - the item to insert.
findMin
public Comparable findMin()
- Find the smallest item in the priority queue.
- Returns:
- the smallest item, or null, if empty.
deleteMin
public Comparable deleteMin()
- Remove the smallest item from the priority queue.
- Returns:
- the smallest item, or null, if empty.
isEmpty
public boolean isEmpty()
- Test if the priority queue is logically empty.
- Returns:
- true if empty, false otherwise.
isFull
public boolean isFull()
- Test if the priority queue is logically full.
- Returns:
- false in this implementation.
makeEmpty
public void makeEmpty()
- Make the priority queue logically empty.
main
public static void main(String[] args)
All Packages Class Hierarchy This Package Previous Next Index