Enqueue With Wraparound
easyQuestion 419CircularQueue never shifts. It tracks where the queue starts (front) and how many values it holds (size), so the next free slot can run off the end of the array and wrap back to index 0. Only enqueue is missing.
Requirements: 1. Return false when the queue is full. 2. Otherwise work out the rear index from front and size, wrapping with % CAPACITY, store the value there, increase size and return true.
Do NOT write a main method.
Expected output
Queue: 10 20 30 40 50 10 20 true true Queue: 30 40 50 60 70 false 5
= 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.