ProAnswers.org

algorithm Representation of Queue Data Structure

algorithm Representation of Queue Data Structure

Representing queue data structure

Array representation

typedef struct queue{
int QArray[MAX_SIZE+1];//can accommodate MAX_SIZE number of elements
int front, rear;
}queue;

Linked list representation

typedef struct QNode{
int data;
struct QNode *next;
}QNode;

typedef struct queue{
QNode *front, *rear;
}queue;