Given a circular array implementation of a queue in this state:
with queue.length as 7, you are to finish the trace of
ensureCapacity(). Refer back to ensureCapacity() and complete the trace.
What are the values of frontIndex and backIndex after the call is complete?
queue | oldQueue | oldLength | newLength | j | i | frontIndex | backIndex |
---|---|---|---|---|---|---|---|
x,5,7,7,1,3,2 | x,5,7,7,1,3,2 | 7 | 14 | 1 | 6 | ||
x, x, x, x, x, x, x, x, x, x, x, x, x, x | 1 | 6 | |||||
5, x, x, x, x, x, x, x, x, x, x, x, x, x | 1 | 0 | 1 | 6 | |||
5, 7, x, x, x, x, x, x, x, x, x, x, x, x | 2 | 1 | 1 | 6 | |||
......... |
There are no hints for this question