Computer Science, asked by deepikaepik, 6 hours ago

you have implemented a queue using two stacks.the queue should support dequeue operation in o(1).how many push/pop operations on the stacks are required to support the following sequence of queue operations ? enqueue(5);
enqueue(6);
dequeue();
enqueue(3);
enqueue (4);
dequeue()​

Answers

Answered by anirudhayadav393
37

Concept Introduction: Push Pop operations are a part of Computer Application.

Explanation:

We have been Given: You have implemented a queue using two stacks.the queue should support dequeue operation in o(1).

We have to Find: How many push/pop operations on the stacks are required to support the following sequence of queue operations ?

Only two Push or Pop operations are required of all elements of the stack.

Final Answer: Only two Push or Pop operations are required of all elements of the stack.

#SPJ2

Answered by babysatya2002
10

Answer:

8 enqeues 6 deqeues

Explanation:

enqueue(5);

enqueue(6);

dequeue();

enqueue(3);

enqueue (4);

dequeue()

Similar questions