1,100 views
5 votes
5 votes
Consider a stack with 100 elements present. Suppose in a scenario, we are required to remove the first inserted element in it, which is done by POP operations followed by PUSH operations with intermediate elements temporarily being saved in an array. After $10$ such removals, without anyother intermediate PUSH/POP operations, total number of PUSH operations required is ______

1 Answer

Best answer
8 votes
8 votes
Initially we do 100 POP followed by 99 PUSH.

For 10 such operations we would do

$99 + 98 + 97+96+95+94+93+92+91+90 = 900+45 = 945$ PUSH operations.
selected by
Answer:

Related questions

2 votes
2 votes
2 answers
1
0 votes
0 votes
1 answer
3
Arjun asked Oct 10, 2016
404 views
The postfix expression for the infix expression$$A + B*C/D +E$$isAB+*CD/E+ABC*D/+E+AB+C*D/E+A+*BCD/E+
0 votes
0 votes
2 answers
4
Arjun asked Oct 10, 2016
481 views
Which of the following permutation can be obtained in the output (in the same order) using a stack assuming that the input is the sequence $1, 2, 3, 4$ in that order?3, 4...