1.

Evaluate the following postfix using stack & show the content of the stack after the execution of each:20, 4, +, 3, -, 7, 1

Answer»
S.noSymbolOperationStackResult
120push(20)20
24push(4)20, 4
3+pop(4)20
4pop(20)
perform(20+4)
push (24)24
53push(3)24,3
6-pop(3)24
pop(24)
perform(24-3)
push (21)21
77push (7)21,7
8/pop(7)21
pop(21)
perform(21/7)
push (3)3
9pop(3)Result = 3



Discussion

No Comment Found

Related InterviewSolutions