Dequeue by Shifting Left
easyQuestion 418ShiftQueue keeps the front of the queue at index 0, so removing it means sliding every later value down one slot. Only dequeue() is missing, and its empty guard plus the line that saves the front value are already written.
Requirements:
1. Move items[1] through items[size - 1] one slot to the left.
2. Decrease size and return the saved value.
Do NOT write a main method.
Expected output
10 Queue: 20 30 20 Queue: 30 1
= 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.