All queues hand out elements according to a rule, but the rule and the way elements enter and leave can differ. This page describes the four common kinds of queue, what makes each one different, and where each one is used.
Types of Queue in Data Structure
- Simple Queue or Linear Queue
- Circular Queue
- Priority Queue
- Deque (Double Ended Queue)
Each type is explained below with a short definition and a diagram.
1. Simple Queue or Linear Queue
A simple queue is the basic FIFO queue (First In, First Out): elements are added at the rear (tail) and removed from the front (head), so they leave in the order they arrived. Elements cannot be inserted or removed in the middle.
When a simple queue is stored in an array without wrap-around, the slots freed at the front are never reused.

2. Circular Queue
A circular queue is a FIFO queue stored in an array whose last position is treated as being followed by the first one. When the rear index reaches the end of the array, it wraps around to index 0.
This fixes the main weakness of a simple array queue: there, once the rear reaches the end, nothing more can be added even if elements have been removed from the front. A circular queue reuses those freed slots, so a fixed amount of memory serves an endless stream of elements. That makes it the standard choice for buffers in operating systems, device drivers and streaming code.
A circular queue is also called a ring buffer.

3. Priority Queue
In a priority queue, each element has a priority, and the element with the best priority is removed first, no matter when it arrived. In Java's PriorityQueue, the "best" element is the smallest one by natural ordering unless a Comparator says otherwise.
Characteristics of a priority queue:
- Every element has a priority, given by its value or by a comparator.
- Removal always returns the element with the best priority.
- Elements with equal priority are not guaranteed to leave in arrival order;
java.util.PriorityQueuebreaks such ties arbitrarily.
4. Deque (Double Ended Queue)
A deque (double-ended queue) allows insertion and deletion at both the front and the rear.
The following diagram shows a deque.

Because either end can be used for removal, a deque is not limited to FIFO order: used from one end only it behaves as a stack (LIFO), and used by adding at one end and removing at the other it behaves as a queue (FIFO).
Types of Deque in Data Structure
Restricting one of the two ends gives two special kinds of deque:
- Input restricted queue
- Output restricted queue
They are described below.
Input restricted queue: elements can be inserted at only one end, but deleted from both ends.
The diagram shows insertion at the rear only and deletion at both the front and the rear.

Output restricted queue: elements can be deleted at only one end, but inserted at both ends.
The diagram shows insertion at both the front and the rear and deletion at the rear only.
