7,928 views
3 votes
3 votes
What are the minimum enqueue and dequeue operations needed to perform pop operation for a stack which is implemented with two queues if there are already 10 elements in the first queue?

3 Answers

1 votes
1 votes

If we wand to delete 1 element from stack .then we need to perfome 9EQ and 10 DQ OPERATION.

0 votes
0 votes
to pop 1 element from stack we have 10 dequeue and 9 enqueue. Similarly for popping subsequent elements from stack the series become

DEQUEUE- 10+9+8+7+6+5+4+3+2+1=  55 dequeues

ENQUEUE- 9+8+7+6+5+4+3+2+1+0=  45 enqueues

Related questions

2 votes
2 votes
2 answers
1