📦 Queue – Data Structure¶
Like a Stack, a Queue is also a linear data structure.
However, it follows the FIFO principle (First In, First Out), meaning the first element inserted is the first to be removed.
⚙️ Basic Queue Operations¶
Here are the fundamental operations you can perform on a queue:
- ➕
enqueue()– Adds an element to the rear of the queue - ➖
dequeue()– Removes the front element of the queue - 👁️
peek()orfront()– Returns the front element without removing it - 🔚
rear()– Returns the last element without removing it - 🧱
isFull()– Checks whether the queue is full - ⚪
isNull()– Checks whether the queue is empty
🧪 Implemented Methods¶
In this package, we implement the following methods for the Queue data structure:
| 🗃️ Data Structure | 🛠️ Available Methods |
|---|---|
| Queue | enqueue(), dequeue(), peek(), rear(), is_empty(), display() |
🔁 Note: In our implementation,
is_empty()is used instead ofisNull()for consistency with common coding conventions.