Queue Data Structure

  • Last Updated : 18 Jun, 2022

Data Structure and Algorithms Course
Practice Problems on Queue
Recent articles on Queue

A Queue is a linear structure which follows a particular order in which the operations are performed. The order is First In First Out (FIFO). A good example of a queue is any queue of consumers for a resource where the consumer that came first is served first. The difference between stacks and queues is in removing. In a stack we remove the item the most recently added; in a queue, we remove the item the least recently added.

Topics :

Introduction :

  1. Queue
  2. Applications of Queue Data Structure
  3. Priority Queue
  4. Applications of Priority Queue
  5. Deque
  6. Circular Queue
  7. Queue Interface In Java
  8. Queue In Python
  9. Queue In C#


Implementation :

  1. Implement Queue using Stacks
  2. LRU Cache Implementation
  3. Implement Stack using Queues
  4. Queue | Set 2 (Linked List Implementation)
  5. How to efficiently implement k Queues in a single array?
  6. Implement a stack using single queue
  7. Implementation of Deque using circular array
  8. Circular Queue | Set 2 (Circular Linked List Implementation)
  9. Implement Stack and Queue using Deque
  10. Priority Queue using Linked List
  11. Priority Queue using doubly linked list
  12. Implementation of Deque using doubly linked list

Standard Problems :

  1. Check if a queue can be sorted into another queue using a stack
  2. Breadth First Traversal or BFS for a Graph
  3. Level Order Tree Traversal
  4. Reverse a path in BST using queue
  5. Construct Complete Binary Tree from its Linked List Representation
  6. Program for Page Replacement Algorithms | Set 2 (FIFO)
  7. Check whether a given Binary Tree is Complete or not | Set 1 (Iterative Solution)
  8. Number of siblings of a given Node in n-ary Tree
  9. ZigZag Tree Traversal
  10. FIFO (First-In-First-Out) approach in Programming
  11. FIFO vs LIFO approach in Programming
  12. LIFO (Last-In-First-Out) approach in Programming

Operations on Queue :

  1. Reversing a Queue
  2. Reversing a queue using recursion
  3. Reversing the first K elements of a Queue
  4. Interleave the first half of the queue with second half
  5. Sorting a Queue without extra space

Misc :

  1. Level order traversal in spiral form
  2. Sliding Window Maximum (Maximum of all subarrays of size k)
  3. Find the largest multiple of 3 | Set 1 (Using Queue)
  4. Find the first circular tour that visits all petrol pumps
  5. Smallest multiple of a given number made of digits 0 and 9 only
  6. Iterative Method to find Height of Binary Tree
  7. Implement PriorityQueue through Comparator in Java
  8. An Interesting Method to Generate Binary Numbers from 1 to n
  9. Minimum time required to rot all oranges
  10. Find maximum level sum in Binary Tree
  11. Sum of minimum and maximum elements of all subarrays of size k.
  12. Distance of nearest cell having 1 in a binary matrix
  13. Level order traversal line by line | Set 2 (Using Two Queues)
  14. First negative integer in every window of size k
  15. Minimum sum of squares of character counts in a given string after removing k characters
  16. Queue based approach for first non-repeating character in a stream
  17. Averages of Levels in Binary Tree
  18. Stack Permutations (Check if an array is stack permutation of other)
  19. Check if all levels of two trees are anagrams or not
  20. Check mirror in n-ary tree
  21. Check if X can give change to every person in the Queue

Quick Links :

GeeksforGeeks Courses:

Complete Interview Preparation

Prepare for a job interview with confidence and clarity, Here you’ll get prepared for each and every subject & skill relevant to the interview whether it be core CS subjects, programming language, reasoning & aptitude, resume building, etc. at budget-friendly prices with GeeksforGeeks Complete Interview Preparation Course.

Live Courses

Enrol today to learn data structures, Get best-in-industry real-time GFG Live Courses to upskill yourself and get into your dream company. You can attend these live classes from any geographical region and here you can ask your doubts to the instructor just like an offline classroom program. Do check out these valuable Live Courses by GeeksforGeeks – DSA Live for Working Professionals, System Design Live, Competitive Programming Live, and more!

Language Foundation Courses[C Programming / C++ / JAVA / Python ]

Each language is designed to get you right into hands-on practice by offering Language Foundation Courses. Learn any programming language from scratch and understand all its fundamental concepts for a strong programming foundation in the easiest possible manner at best price possible with help of GeeksforGeeks Language Foundation Courses – C Programming | Java Foundation | Python Foundation | C++ Foundation.

My Personal Notes arrow_drop_up

Writing code in comment? Please use ide.geeksforgeeks.org, generate link and share the link here.