About 6,580,000 results
Open links in new tab
  1. 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 …

  2. Stack using Two Queues in C - Sanfoundry

    This is a C Program to implement stack using queue. The idea is pretty simple. We start with an empty queue. For the push operation we simply insert the value to be pushed into the queue. …

  3. algorithm - Implement Stack using Two Queues - Stack Overflow

    Mar 27, 2009 · Given two queues with their standard operations (enqueue, dequeue, isempty, size), implement a stack with its standard operations (pop, push, isempty, size). There should …

  4. Implement Stack Using Two Queues - Baeldung

    Mar 18, 2024 · To construct a stack using two queues (q1, q2), we need to simulate the stack operations by using queue operations: push ( E element ) if q1 is empty, enqueue E to q1

  5. Implementation of Queue using two stacks in C - PrepInsta

    Here, in this section we will learn, Implementation of Queue using two stacks in C . We will built enqueue operation , dequeue operation functions using stacks. We take two stacks say stack1 …

  6. Implement Stack using Queues - EnjoyAlgorithms

    Write a program to implement a stack using queues. We must use queue operations like enqueue, dequeue, front, size to implement stack operations like push, pop, and top. We have …

  7. Stack Using 2 Queues - InterviewBit

    Nov 19, 2021 · Implement a class Stack, using 2 Queues, which can perform the following operations: Push (): Push a value into the stack. Pop (): Pop last inserted element from the …

  8. Implement a stack using the queue data structure - Techie …

    Dec 1, 2021 · There are several ways to implement a stack using one or two queues by tweaking their enqueue and dequeue operations. 1. Using Two Queues. The idea is to implement the …

  9. Stack using Queue | Data Structure Tutorial - Studytonight

    Assuming we already have a class implemented for Queue, we first design the class for Stack. It will have the methods push() and pop() and two queues. public: // two queue. Queue Q1, Q2; …

  10. Implementation of stacks using queues - Naukri Code 360

    Aug 25, 2024 · In this method, we will use two queues for the implementation of stacks using queues. The idea is to keep the last entered element at the front of the queue. Why? Because …

  11. Some results have been removed
Refresh