A Queue is a linear First-In-First-Out (FIFO) data structure which means that the first element added to the queue will be the first one to be removed. Therefore, once a new element is added to the queue, all elements that were added before have to be removed before the new element can be removed.
In this post, we have listed out commonly asked interview questions that use queue data structure:
- Queue implementation using an array – C, C++, Java, PythonBeginner
- Queue Implementation using a Linked ListBeginner
- Implement a stack using the queue data structureMedium
- Implement a queue using the stack data structureMedium
- Efficiently print all nodes between two given levels in a binary treeEasy
- Chess Knight Problem | Find the shortest path from source to destinationHard
- Shortest path in a maze – Lee AlgorithmMedium
- Find the shortest safe route in a field with sensors presentHard
- Flood Fill AlgorithmMedium
- Count number of islandsMedium
- Find the shortest path from source to destination in a matrix that satisfies given constraintsHard
- Generate binary numbers between 1 to
n
using a queueEasy - Calculate the height of a binary treeEasy
- Delete a binary treeEasy
- Level order traversal of a binary treeEasy
- Spiral order traversal of a binary treeMedium
- Reverse level order traversal of a binary treeEasy
- Print all nodes of a perfect binary tree in a specific orderHard
- Print left view of a binary treeEasy
- Find the next node at the same level as the given node in a binary treeMedium
- Check if a binary tree is a complete binary tree or notMedium
- Print diagonal traversal of a binary treeMedium
- Print corner nodes of every level in a binary treeEasy
- Invert Binary TreeEasy
- Find minimum passes required to convert all negative values in a matrixHard
- Convert a binary tree into a doubly-linked list in spiral orderHard
- Check if a binary tree is a min-heap or notMedium
- Invert alternate levels of a perfect binary treeHard
- Convert a Binary Search Tree into a Min HeapHard
- Snake and Ladder ProblemHard
- Find the shortest distance of every cell from a landmine inside a mazeHard
- Convert a multilevel linked list to a singly linked listMedium
- Check if an undirected graph contains a cycle or notMedium
- Find maximum cost path in a graph from a given source to a given destinationMedium
- Total paths in a digraph from a given source to a destination having exactly
m
edgesMedium - Least cost path in a digraph from a given source to a destination having exactly
m
edgesMedium - Breadth-First Search (BFS)Medium
- Traverse a given directory using BFS and DFS in JavaEasy
- Perform vertical traversal of a binary treeMedium
- Compute the maximum number of nodes at any level in a binary treeEasy
- Print right view of a binary treeMedium
- Find the minimum depth of a binary treeEasy
- Depth-First Search (DFS) vs Breadth-First Search (BFS)Beginner
- Bipartite GraphMedium
- Compute the least cost path in a weighted digraph using BFSMedium
- Find the path between given vertices in a directed graphEasy
- Construct a directed graph from an undirected graph that satisfies given constraintsMedium
- Print nodes of a binary tree in vertical orderMedium
Thanks for reading.
To share your code in the comments, please use our online compiler that supports C, C++, Java, Python, JavaScript, C#, PHP, and many more popular programming languages.
Like us? Refer us to your friends and support our growth. Happy coding :)