Queues
Subtitle
Contents
What are queues
A queue is a first in first out data structure. Any new items can only be added the end of the queue. Items may only be removed from the front of the queue.
Usages
- Printers
- CPU interrupts
- Keys pressed on a keyboard.
Operations on a Queue
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
Link to original
- isEmpty - Checks if the array is empty or not
- isFull - Checks if the array is full or not