Operations on a Queue
Subtitle
Queues have operations on them that allow for items to be removed and added from the queue.
Basic operations
Here is a basic queue with its pointers
←A | B | C | D | ← | |
---|---|---|---|---|---|
front=0 | rear=3 |
Adding (enqueue)
←A | B | C | D | E | ← |
---|---|---|---|---|---|
front=0 | rear=4 |
Removing (dequeue)
Note
The elements do not move.
B | C | D | E | ← | |
---|---|---|---|---|---|
front=1 | rear=4 |
Other operations
- isEmpty - Checks if the array is empty or not
- isFull - Checks if the array is full or not