CJCoding With Joseph
15free / daySign inCreate account

Dequeue From a Circular Queue

CircularQueue removes a value by moving front forward instead of shifting the whole array. Every method except dequeue() is already written.

Requirements:
1. Return -1 when the queue is empty.
2. Otherwise save items[front], then move front forward one slot, wrapping it with % CAPACITY.
3. Decrease size and return the saved value.

Do NOT write a main method.

Expected Output:

10
20
Queue: 30 40 50
Queue: 30 40 50 60 70
30
Queue: 40 50 60 70
4

= newline. The output ends with a newline — print one after the last line.

Hints4 available
Topics:
Data Structures & AlgorithmsQueues
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (sysout, psvm, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.