1. Engineering
  2. Computer Science
  3. susan decides to implement a queue of maximum length n...

Question: susan decides to implement a queue of maximum length n...

Question details

Susan decides to implement a queue of maximum length N in an array of size N by keeping track of the positions of the first and last elements of the queue, rather than the position of the first element and the length of the queue; she figures this will save her some modular arithmetic and the code will be clearer. Unfortunately, she can’t seem to get her code to work; why not? What alternatives will work correctly?

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution