Types of Queue in Data Structure

In the real world, a queue is defined as a row of elements in which one element enters from one side and exits from the other. Similarly, in data structures, the queue exhibits the same property, i.e., we can add an element from the rear end, which is also known as the tail of the queue, and remove an element from the front end, which is also known as the head of the queue. This queue characteristic is FIFO (First In, First Out). In this article, we will discuss types of queue in data structure in depth.
What Are the Types of Queue in Data Structure?
There are four main types of queue in data structure: a simple queue, which inserts at the rear and deletes at the front; a circular queue, whose rear wraps around to reuse freed space; a priority queue, which serves the highest-priority element first; and a double-ended queue (deque), which allows insertion and deletion at both ends.
Build an AI-First Career, Master the Complete Skillset
Choose from our industry-leading programs designed for career success
Modern Software and AI Engineering Program
Master full-stack development with AI integration
+1000 moreModern Data Science and ML with specialisation in AI
Advanced data science techniques with AI specialization
+1000 moreAdvanced AIML with Specialisation in Agentic AI
Deep dive into AIML with focus on Agentic systems
+1000 moreDevOps, Cloud & AI Platform Engineering
Build and manage AI-powered cloud infrastructure
+1000 moreAI Engineering Advanced Certification by IIT-Roorkee
Premier AI engineering certification from IIT-Roorkee
AI Forward Deployed Engineer Program
Full-stack engineering, production AI and client-facing consulting
+1000 moreTypes of Queue: Comparison Table
For related concepts, explore the wider family of linear data structures.
| Type | How it differs | Insertion | Deletion | Time | Typical use |
|---|---|---|---|---|---|
| Simple queue | Plain FIFO, one end each | At rear only | At front only | O(1) | Print spoolers, request buffers |
| Circular queue | Rear wraps to index 0, reusing freed slots | At rear, (rear + 1) % N | At front, (front + 1) % N | O(1) | Ring buffers, CPU scheduling, streaming I/O |
| Priority queue | Order is by priority, not arrival | By priority (heap) | Highest priority first | O(log n) with a binary heap | Dijkstra's, A*, task schedulers |
| Deque | Both ends are open | At front or rear | At front or rear | O(1) | Sliding window, undo/redo, work stealing |

There are four types of queues:
- Simple Queue
- Circular Queue
- Priority Queue
- Double-ended Queue
:::
Simple Queue
In a simple queue, we follow the First In, First Out (FIFO) rule. Insertion takes place at one end, i.e., the rear end or the tail of the queue, and deletion takes place at the other end, i.e., the front end or the head of the queue. It is employed in scenarios where data consumption should follow FIFO order, but recent data insertion may need to be removed due to factors like irrelevant data or performance issues. It is also called the Input restricted queue.
It prevents queue overflow and overloading by restricting the number of items added, and it helps maintain system stability and predictable performance.
The time complexity of a simple queue is O(1) for insertion and deletion operations.

Circular Queue
A Circular Queue, also known as a Ring Buffer, is a type of linear data structure that adheres to the FIFO (First In, First Out) principle. Unlike a traditional queue, the last position in a Circular Queue is linked back to the first position, forming a circular arrangement.
Key points about Circular Queue:
- It operates on the FIFO principle, where the rear is connected to the end, creating a circular structure.
- Commonly referred to as a ring buffer due to its circular nature.
- Insertion and deletion operations in a Circular Queue have a constant time complexity of O(1), making it efficient for managing data.
- Circular Queues find application in various domains such as memory management, traffic systems, and CPU scheduling due to their efficient operation and ability to manage data in a cyclical manner.

Note: To learn more about the circular queues, go to Circular Queue in Data Structure.
Priority Queue
A priority queue also exhibits similar characteristics to a simple queue where each element is assigned a particular priority value, where elements in the queue are assigned based on priority.
-
There are two types of priority queues:
- Ascending Order: In this priority queue, the elements are arranged in ascending Order of their priority, i.e., the element with the smallest priority comes at the start, and the element with the greatest priority comes at the end.
- Descending Order: In this priority queue, the elements are arranged in descending Order of their priority, i.e., the element with the greatest priority is at the start, and the element with the smallest priority is present at the end of the queue.
For insertion and deletion, the priority queue has a time complexity of O(logn). More information can be found at Priority Queue in Data Structure.

Double Ended Queue
A Double-ended Queue, or Deque, is a different type of queue where enqueue (insertion) and dequeue (deletion) operations are performed at both ends, i.e., the rear-end (tail) and the front-end (head). The Deque data structure supports clockwise and anticlockwise rotations in O(1) time, which can be useful in certain applications.
The Deque can further be divided into two special queues, i.e., Input-restricted Deque and Output-Restricted Deque.
The time complexity of a double-ended queue is O(1) for insertion and deletion.

How Scaler Transformed Careers in Different Fields
Scaler learners achieved 2.5x salary growth with average post-Scaler CTC reaching ₹23L.
Applications of Queue
Different real-world problems are solved using queues very efficiently. Here some of the major applications are listed below-
- Linear queues manage data sequentially, with additions at one end and removals from the other, commonly seen in printer or message queues.
- Circular queues, akin to linear queues but with a circular connection, optimize memory use and enhance performance, which is ideal for CPU scheduling and management.
- Priority queues prioritize tasks based on assigned levels, ensuring high-priority items are handled first, used in OS task scheduling and network packet prioritization.
- Double-ended queues, or deques, allow flexibility with additions or removals from either end, offering versatile data processing for applications like job scheduling and search algorithms.
- Concurrent queues are designed for simultaneous access by multiple threads, ensuring thread-safe data sharing, such as database transactions and web server requests, in multi-threaded environments.
- Queues find utility in scenarios where the processing doesn't demand immediate attention but follows a First In, First Out order, such as in Breadth First Search algorithms.
- They are instrumental in situations involving shared resources among multiple consumers, like CPU or disk scheduling.
- Asynchronous data transfer between processes benefits from queues, facilitating orderly management in IO buffers, pipes, or file IO.
Conclusion
- Queues adhere to the FIFO (First-In-First-Out) rule, meaning the first element added is the first to be removed.
- There are four main types of queues: Simple Queue, Circular Queue, Priority Queue, and Double-ended Queue.
- Priority queues can be categorized into Ascending and Descending based on the priority order of elements.
- Operations in a queue typically involve adding elements to the back end and deleting elements from the front end.
FAQs
Turn Learning into Career Growth
How many types of queue are there in data structure?
There are four main types: simple, circular, priority and double-ended (deque). Some textbooks count input-restricted and output-restricted deques separately, giving six labels. In the standard four-type classification used here, those two are deque variants rather than separate fundamental queue structures.
What is the difference between a simple queue and a circular queue?
A simple array queue can report full when rear reaches the final index, even after elements have been removed from the front. A circular queue uses modulo arithmetic to wrap rear back to index 0, reuse freed slots and track fullness using count == capacity.
Is a priority queue the same as a heap?
No. A priority queue is an abstract data type defined by which element is served next. A binary heap is a common implementation and gives O(log n) insertion and deletion. An array or linked list can also implement a priority queue, but its operation costs depend on how it is organized.
What is the time complexity of queue operations?
For simple and circular queues, insertion and deletion are O(1) when implemented with an array and maintained indices. A deque supports both-end operations in O(1) with a suitable deque implementation. A binary-heap priority queue typically takes O(log n) to insert or remove the top-priority item; peek is O(1).
When should you use a deque instead of a queue?
Use a deque when both ends need updates. Sliding-window algorithms remove old items from the front and add new ones at the rear; undo/redo histories may remove or restore the most recent operation; work-stealing schedulers may take tasks from opposite ends. A basic FIFO queue cannot perform all these operations directly.
Which type of queue is used in CPU scheduling?
A circular queue fits round-robin CPU scheduling because the process order loops back around after the last entry. A priority queue fits priority-based scheduling because higher-priority work can be selected first. These are different policies, so the choice depends on whether fairness by rotation or priority by rank is required.