Last Updated : 23 Jul, 2025
Similar to Stack, Queue is a linear data structure that follows a particular order in which the operations are performed for storing data. The order is First In First Out (FIFO). One can imagine a queue as a line of people waiting to receive something in sequential order which starts from the beginning of the line.
For implementing the queue, we only need to keep track of two variables: front
and size
. We can find the rear as front + size - 1.
Operations Complexity Enqueue (insertion) O(1) Deque (deletion) O(n) Front (Get front) O(1) Rear (Get Rear) O(1) IsFull (Check queue is full or not) O(1) IsEmpty (Check queue is empty or not) O(1) Circular Array implementation Of Queue:Please refer Simple Array implementation of Queue for implementation.
We can make all operations in O(1) time using circular array implementation.
Operations Complexity Enqueue (insertion) O(1) Deque (deletion) O(1) Front (Get front) O(1) Rear (Get Rear) O(1) IsFull (Check queue is full or not) O(1) IsEmpty (Check queue is empty or not) O(1)Please refer Circular Array implementation Of Queue for details of implementation
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4