///
///
// Queue data structure queue.h //
///
//
#include
Template
Template
{
Friend class queue
Private:
TYPE DATA;
QueuNode
QueuNode (Type D = 0, QueuNode * L = NULL): DATA (D), LINK (L) {}
}
Template
{
PUBLIC:
Queue (): REAR (NULL), Front (NULL) {}
~ Queue ();
Void Enqueue (Type Item);
TYPE DELQUE ();
TYPE GETFRONT ();
Void makeempty ();
Bool isempty () {return front == NULL;}
Private:
QueuNode
}
Template
Queue
{
QueuNode
While (Front! = NULL)
{
p = front;
Front = front-> link;
Delete P;
}
}
Template
Void queue
{
IF (Front == Null)
Front = Rear = new queuenode
Else
REAR = Rear-> link = new queuenode
}
Template
TYPE Queue
{
QueuNode
TYPE TEMP = P-> DATA ;;
Front = front-> link;
Delete P;
Return Temp;
}
Template
TYPE Queue
{
Return Front-> Data;
}
Template
Void queue
{
QueuNode
While (Front! = NULL)
{
p = front;
Front = front-> link;
Delete P;
}
}