# Queue Data Structure

Last Updated :
11 May, 2024

Improve

A ** Queue Data Structure **is a fundamental concept in computer science used for storing and managing data in a specific order. It follows the principle of “

**”**

**First in, First out****, where the first element added to the queue is the first one to be removed. Queues are commonly used in various algorithms and applications for their simplicity and efficiency in managing data flow.**

**(FIFO)**Table of Content

- What is Queue in Data Structures?
- Basic Operations of Queue Data Structure
- Applications of Queue
- Basics of Queue Data Structure
- Implementations of Queue in various Programming Languages
- Other Implementations of Queue Data Structure
- Easy Problems on Queue Data Structure
- Medium Problems on Queue Data Structure
- Hard Problems on Queue Data Structure

## What is Queue in Data Structures?

A queue is a linear data structure that follows the** First-In-First-Out (FIFO)** principle. It operates like a line where elements are added at one end (

**) and removed from the other end (**

**rear****).**

**front**## Basic Operations of Queue Data Structure

: Adds an element to the rear of the queue.**Enqueue (Insert)**: Removes and returns the element from the front of the queue.**Dequeue (Delete)**: Returns the element at the front of the queue without removing it.**Peek**: Checks if the queue is empty.**Empty**: Checks if the queue is full.**Full**

## Applications of Queue

in operating systems**Task scheduling**in network communication**Data transfer**of real-world systems (e.g., waiting lines)**Simulation**for event processing queues for event processing**Priority queues**

**Implementation of Queues**

**Implementation of Queues**

Queues can be implemented using Two techniques:

- Implementations of Queue Data Structure using Arrays
- Implementations of Queue Data Structure using Linked List

**Basics of Queue Data Structure**

**Basics of Queue Data Structure**

- Introduction to Queue â€“ Data Structure and Algorithm Tutorials
- Basic Operations of Queue Data Structure
- Different Types of Queue
- Applications, Advantages and Disadvantages of Queue

**Implementations of Queue in various Programming Languages**

**Implementations of Queue in various Programming Languages**

- Queue in C++ Standard Template Library (STL)
- Queue Interface In Java
- Queue In Python
- Queue In C#
- Queue in Javascript

**Other Implementations of Queue Data Structure**

**Other Implementations of Queue Data Structure**

- Implementation of Deque using doubly linked list
- Implement a stack using single queue
- Implement Queue using Stacks
- How to efficiently implement k Queues in a single array?
- LRU Cache Implementation

**Easy Problems on Queue Data Structure**

**Easy Problems on Queue Data Structure**

- Implement Stack using Queues
- Detect cycle in an undirected graph using BFS
- Breadth First Search or BFS for a Graph
- Traversing directory in Java using BFS
- Vertical order traversal of Binary Tree using Map
- Print Right View of a Binary Tree
- Find Minimum Depth of a Binary Tree
- Check whether a given graph is Bipartite or not

**Medium Problems on Queue Data Structure**

**Medium Problems on Queue Data Structure**

- Flatten a multilevel linked list
- Level with maximum number of nodes
- Find if there is a path between two vertices in a directed graph
- Print all nodes between two given levels in Binary Tree
- Find next right node of a given key
- Minimum steps to reach target by a Knight
- Islands in a graph using BFS
- Level order traversal line by line | Set 3 (Using One Queue)
- Find the first non-repeating character from a stream of characters

**Hard Problems on Queue Data Structure**

**Hard Problems on Queue Data Structure**

- Sliding Window Maximum (Maximum of all subarrays of size K)
- Flood Fill Algorithm
- Minimum time required to rot all oranges
- Shortest path in a Binary Maze
- An Interesting Method to Generate Binary Numbers from 1 to n
- Maximum cost path from source node to destination
- Shortest distance between two cells in a matrix or grid
- Snake and Ladder Problem
- Find shortest safe route in a path with landmines
- Count all possible walks from a source to a destination with exactly K edges
- Minimum Cost of Simple Path between two nodes in a directed and weighted graph
- Minimum Cost Path in a directed graph via given set of intermediate nodes
- Find the first circular tour that visits all petrol pumps

**Quick Links:**

**Recommended:**