1.

Explain the memory representation of queue using arrays.

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 REAR = N To add element, REAR = REAR + 1 
  • To delete element, FRONT = FRONT +1


Discussion

No Comment Found

Related InterviewSolutions