A priority queue is data structure in which intrinsic ordering of the elements does determine the results of its basic operations. These are of two types- ascending (e.g. queue) and descending (e.g. stack).
The following source code implements ascending type priority queue in C:
The following source code implements ascending type priority queue in C:
// Ascending Priority Queue Implementation in C
#include<iostream.h>
#include<conio.h>
const int MAX=5;
class pqueue
{
int front,rear;
public:
struct data
{
int val,p,o;
}d[MAX];