Relationship between a queue and underlying array

Illustrates the relationship between a queue and underlying array of data structure?

E

Expert

Verified

Data stored within a queue is really stored in an array. There are two indexes: front and end will be used to recognize the start and end of the queue.

While an element is removed front will be incremented through 1. In case this reaches past the last index available this will be reset to 0. After that it will be checked with end. If this is greater than end queue is empty.

While an element is added end will be incremented with 1. In case this reaches past the last index available this will be reset to 0. After such incrementing this will be checked with front. When they are equal queue is full.

   Related Questions in Database Management System

©TutorsGlobe All rights reserved 2022-2023.