in DS recategorized by
994 views
1 vote
1 vote
What is the maximum number of activation records inserted into stack while converting following infix expression to postfix expression is Infix expression: $\text{7+5*3^2/(9-2^2)+6*4}$
in DS recategorized by
994 views

9 Comments

"maximum number of activation records inserted into stack" 

All the Operators are pushed on to the stack

=> Total insertions will be equal to total number of operators i.e. 10

0
0

i think asked max at same time i.e depth of stack.?

0
0

@Hemanth_13

can at a time all those 10 present in the stack ?

@Abhisek Tiwari 4

yes

0
0
moved by
But Answer is given as 5
0
0

No @Shaik Masthan all of them will not be on stack at a same time but the question was about how many were inserted so answered accordingly.

Anyway I'm getting only 4 operators on stack at a time.

0
0

@Hemanth_13

i hope question was mistaken, their intension should be what is the maximum records at a time

+,/,(,-,^ ===> all these are present at a time ==> maximum = 5

2
2
Yes you are right :)
0
0
0
0
1
1

Please log in or register to answer this question.

Answer:

Related questions