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
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
10
Answer:
8 enqeues 6 deqeues
Explanation:
enqueue(5);
enqueue(6);
dequeue();
enqueue(3);
enqueue (4);
dequeue()
Similar questions
English,
19 days ago
Physics,
19 days ago
Social Sciences,
1 month ago
Hindi,
1 month ago
Geography,
9 months ago