Dequeue From a Circular Queue
easyQuestion 420CircularQueue 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, so print one after the last line.
Hints4 available
Sign in to use hintsTopics
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.