geeksforgeeks
search icon
  • Courses
    Sale
  • Tutorials
  • Interview Prep
    Videos
    July 15, 2024 |13.9K Views

    Reversing a Queue

    Queue, queue
     Save  Share   Like
    Description
    Discussion

    Give an algorithm for reversing a queue Q. Only following standard operations are allowed on queue. 
     

    enqueue(x) : Add an item x to rear of queue.
    dequeue() : Remove an item from front of queue.
    empty() : Checks if a queue is empty or not.

    Reversing a Queue: https://www.geeksforgeeks.org/reversing-a-queue/

    Recommendations
    Video Thumbnail
    07:37
    Video Thumbnail
    43.1K Views | 04/01/2025...
    Queue | Set 2 (Linked List Implementation)
    Video Thumbnail
    07:03
    Video Thumbnail
    6.9K Views | 23/08/2024...
    Reversing a queue using recursion
    Video Thumbnail
    11:51
    Video Thumbnail
    32.5K Views | 21/08/2024...
    Queue | Set 1 (Introduction and Array Implementation)
    Video Thumbnail
    06:49
    Video Thumbnail
    10.5K Views | 15/07/2024...
    Level order traversal in spiral form
    Video Thumbnail
    19:38
    Video Thumbnail
    61.1K Views | 15/07/2024...
    Implement Stack using Queues
    Video Thumbnail
    09:08
    Video Thumbnail
    5.5K Views | 08/07/2022...
    Sorting a queue without extra space
    Video Thumbnail
    02:22
    Video Thumbnail
    4.2K Views | 08/07/2022...
    An Interesting Method to generate binary numbers
    Video Thumbnail
    02:41
    Video Thumbnail
    7.0K Views | 07/07/2022...
    Interleave the first half of the queue with second half
    Video Thumbnail
    05:03
    Video Thumbnail
    5.3K Views | 07/07/2022...
    Queue based approach for first non-repeating character in a stream
    Video Thumbnail
    03:19
    Video Thumbnail
    6.3K Views | 04/07/2022...
    Reversing the first K elements of a Queue
    GeeksforGeeks
    location
    Corporate & Communications Address:
    A-143, 6th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
    location
    Registered Address:
    K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
    GFG App on Play StoreGFG App on App Store
    • Company
    • About Us
    • Legal
    • Privacy Policy
    • Contact Us
    • Advertise with us
    • GFG Corporate Solution
    • Campus Training Program
    • Explore
    • POTD
    • Job-A-Thon
    • Blogs
    • Nation Skill Up
    • Tutorials
    • Programming Languages
    • DSA
    • Web Technology
    • AI, ML & Data Science
    • DevOps
    • CS Core Subjects
    • Interview Preparation
    • Software and Tools
    • Courses
    • ML and Data Science
    • DSA and Placements
    • Web Development
    • Programming Languages
    • DevOps & Cloud
    • GATE
    • Trending Technologies
    • Videos
    • DSA
    • Python
    • Java
    • C++
    • Web Development
    • Data Science
    • CS Subjects
    • Preparation Corner
    • Interview Corner
    • Aptitude
    • Puzzles
    • GfG 160
    • System Design
    @GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved