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
Math,
3 hours ago
English,
3 hours ago
Social Sciences,
6 hours ago
Hindi,
6 hours ago
Geography,
8 months ago