1,029 views
2 votes
2 votes

A queue is implemented using two stacks S1 and S2. Initially the queue contains 1, 2, 3, 4 from front to rear. The following operations are performed in the queue: delete, insert (5), delete, Then how many total no. of push and pop operations are needed to perform the above operation?

a) Push: 12 Pop: 13

b) Push: 15 Pop: 16

c) Push: 11 Pop: 10

d) Push: 12 Pop: 11 

3 Answers

0 votes
0 votes

the delete function given in queue will delete just the first or all the elements of the queue ?

if it deletes all elements of the queue then my answer is PUSH-8  and POP- 8

Related questions

0 votes
0 votes
1 answer
2
Souvik33 asked Nov 2, 2022
840 views
Which data structure would be most appropriate to implement a collection of values with the following 3 characteristicsSingly link list with head and tail pointerDoubly l...