CJCoding With Joseph
15free / daySign inCreate account

Dequeue by Shifting Left

ShiftQueue 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 — 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.