edited by
474 views
0 votes
0 votes

An implementation of a queue Q, using two stacks S1and S2, is given below:

 

The number Push and Pop operation needed is represented by X and Y, then the value of X + Y for following operation are ________.

 

edited by

1 Answer

Best answer
0 votes
0 votes

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Now Simply add total PUSH and POP operation.
PUSH = 9
POP = 8
hence, 17 is the answer.

Answer by @MiNiPanda

Related questions

2 votes
2 votes
4 answers
1
srestha asked Apr 24, 2019
3,731 views
Which of the following data structure is efficient to implement priority queue such as insertion ,deletion, searching?A)Linked ListB)HeapC)Sorted ArrayD)Unsorted ArrayHow...
0 votes
0 votes
1 answer
2
Ram Swaroop asked Jan 27, 2019
1,261 views
Consider the hashing table with 'm' slots and 'n' keys. If the expected number of probes in unsuccessful search is 3. The expected number of probes in a successful search...
1 votes
1 votes
1 answer
4
Kalpataru Bose asked Jan 19, 2018
443 views
Can someone explain the solution along with a picture of how the steps are taking place?