• +91 9723535972
  • info@interviewmaterial.com

Data structure Interview Questions and Answers

Question - What is the relationship between a queue and its underlying array?

Answer - Data stored in a queue is actually stored in an array. Two indexes, front and end will be used to identify the start and end of the queue. When an element is removed front will be incremented by 1. In case it reaches past the last index available it will be reset to 0. Then it will be checked with end. If it is greater than end queue is empty. When an element is added end will be incremented by 1. In case it reaches past the last index available it will be reset to 0. After incrementing it will be checked with front. If they are equal queue is full.

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners