IsEmpty: return true if
a priority queue is empty.
ExtractMin: return the
element with the minimum cost from a priority queue
Insert: insert an element into a priority queue
Update: update an existing element in a priority
queue
Example
#include “PriorityQueue.h”
CTypedPtrHeap<Node> pq; //initialize the priority queue
of
integers pq to be empty;
pq.IsEmpty(); //return true;
Node
*a,*b,*c;
pq.Insert(a); // pq=(a)
pq.Insert(b); // pq=(a,b)
c=pq.ExtractMin(); // assume b’s key is
smaller a’s key. pq=(a); c=b;
//modify
c’s key
pq.Update(c); // update
pq to reflect b is modifed;
pq=(a,b);
pq.IsEmpty(); //return false;