Question: A simple linear Queue can be implemented using a Dynamic Array, indexed from, say, k = 0... CAPACITY, where CAPACITY is tracked dynamically on each
A simple linear Queue can be implemented using a Dynamic Array, indexed from, say, k = 0... CAPACITY, where CAPACITY is tracked dynamically on each new entry. [Assume there are front and back indices] a) Write a simple return-function, or statement in C++, called next_index(I), needed to convert this linear Queue into a 'Circular' queue: where, I, is an index of the array. b) What simple formula or statement in C++ in terms of the next_index() function to let the front index to always point to the front element for Dequeueing from the Queue. c) Write the conditional statement, expressed in terms of next_index(), to test the emptiness of the Circular Queue. (d) Using the front and back, write a C++ conditional statement to test when the Queue is full
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
