About 344,000 results
Open links in new tab
  1. Queue using Stacks - GeeksforGeeks

    Mar 28, 2025 · Given a stack that supports push and pop operations, your task is to implement a queue using one or more instances of that stack along with its operations. A queue can be …

  2. Implement Stack using Queues - GeeksforGeeks

    Mar 25, 2025 · Implement a stack using queues. The stack should support the following operations: Push (x): Push an element onto the stack. Pop (): Pop the element from the top of …

  3. algorithm - How to implement a queue using two stacks ... - Stack Overflow

    Sep 16, 2008 · Compare the sequence of top-of stacks to a direct array implementation of queue. Keep 2 stacks, let's call them inbox and outbox. Enqueue: Dequeue: Using this method, each …

  4. Implementation of Queues using Stack in C - PrepInsta

    How to implement Queue using Stack? Implementation of Queues using Stack in C is a process of creating a queue using Stacks. In this article, we will be using a single stack for the purpose. …

  5. Implement Queue Using Two Stacks - EnjoyAlgorithms

    We should use stack operations like push, pop, top, size, and isEmpty for implementing queue operations like enqueue, dequeue, and front. In this blog, we have discussed two approaches …

  6. Implementation of Queue using Stacks - Tpoint Tech - Java

    Mar 17, 2025 · Let's understand the implementation of Queue using stacks. In the above stack, we can observe that the topmost element is 3. If we perform the delete operation in the above …

  7. How to Implement a Queue Using Two Stacks? - Baeldung

    Oct 15, 2024 · In this article, we saw that the two approaches to implementing a queue using two stacks both rely on the same idea of leveraging the properties of two LIFO (Last-In-First-Out) …

  8. Most efficient way to implement Stack and Queue together

    Sep 21, 2023 · In programming, queues are used to implement algorithms like breadth-first search, round-robin scheduling, and more. There are several ways to implement a data …

  9. How to Implement a Queue Using Two Stacks - Medium

    Sep 6, 2019 · Stacks are arrays that follow the LIFO method, while queues are arrays that follow the FIFO method. Essentially, we want our algorithm to get the capabilities of a queue …

  10. Implement Queue Using Stack - InterviewBit

    Nov 26, 2021 · Queue is First In First Out data structure. Push and pop operations take place through two ends of the queue. It supports enqueue, dequeue, peek operations. So, if you …

Refresh