1.

Explain the memory representation of queue using one-dimensional array.

Answer»

Let Q be a linear array of size N.
The pointer FRONT contains location of front element of the queue (element to be deleted)
The pointer REAR contains location of rear element of the queue (recently added element)
The queue is empty when FRONT = 0
The queue is full when FRONT = N
To add element, REAR = REAR + 1
To delete element, FRONT = FRONT + 1



Discussion

No Comment Found

Related InterviewSolutions