mascoptLib.util.fibHeap
Interface PriorityQueue

All Known Implementing Classes:
FibonacciHeap

public interface PriorityQueue

Protocol for priority queues.

Author:
Origional from Mark Allen Weiss , modified by Ding-Yi Chen on Mar 5, 1999.

Method Summary
 Object deleteMin()
          Remove the smallest item from the priority queue.
 Object findMin()
          Find the smallest item in the priority queue.
 int insert(Object x)
          Insert into the priority queue.
 boolean isEmpty()
          Test if the priority queue is logically empty.
 void makeEmpty()
          Make the priority queue logically empty.
 void toss(Object x)
          Insert into the priority queue quickly, ignore the PriorityQueue validity Duplicates are allowed.
 void validate()
          Validate the priority queue.
 

Method Detail

insert

public int insert(Object x)
Insert into the priority queue. Duplicates are allowed.

Parameters:
x - the item to insert.

findMin

public Object findMin()
               throws Underflow
Find the smallest item in the priority queue.

Returns:
the smallest item.
Throws:
Underflow - if the priority queue is empty.

deleteMin

public Object deleteMin()
                 throws Underflow
Remove the smallest item from the priority queue.

Throws:
Underflow - if the priority queue is empty.

isEmpty

public boolean isEmpty()
Test if the priority queue is logically empty.

Returns:
true if empty, false otherwise.

makeEmpty

public void makeEmpty()
Make the priority queue logically empty.


toss

public void toss(Object x)
Insert into the priority queue quickly, ignore the PriorityQueue validity Duplicates are allowed.

Parameters:
x - the item to insert.

validate

public void validate()
Validate the priority queue.