Problem: to understand the solution, when the length of the queue is 5.
Exercise:
Its solution:
Question: Why is the solution not C A B B B, otherwise everything the same in the "Solution"-picture above?
Problem: to understand the solution, when the length of the queue is 5.
Exercise:
Its solution:
Question: Why is the solution not C A B B B, otherwise everything the same in the "Solution"-picture above?
It's because of the definition of the Queue class in your notes. A queue with capacity stated as 5 seems only to be able to hold 4 elements meaningfully, as it reports full when myBack coincides with myFront, and myBack points after the last element. In this case, the Queue errors saying it's full before the character in question can be overwritten with the B value stored in ch.
[A,B,-,-,-] (k=1) (A)
[-,B,A,B,-] (k=2) (B)
[C,-,A,B,B] (k=3) (A)
[C,A,B,B,B] (k=4) (B)
in my opinion you are right, solution is not true :)