1.

Evaluate the following postfix expression using stack and show the contents after execution of each Operations:470,5,4,^,25,/,6,*

Answer»
S.No.SymbolOperationStackResult
1470push(470)470
25push(5)470,5
34push(4)470,5,4
4^pop(4)479,5
0pop(5)470
perform(5^4)
push(625)470,625
525push(25)470,625,25
6/pop(25)470,625
pop(625)470
perform(625/25)470
push(25)470,25
76push(6)470,25,6
8*pop(6)470,25
pop(25)470
perform(25*6)470



Discussion

No Comment Found

Related InterviewSolutions