2,756 views

1 Answer

0 votes
0 votes

Algorithm

1. Read all the symbols from left to right of the postfix expression

2. If the reading symbol is  $operand$ then push into the stack

3. If the reading symbol is  $operator$, then perform two pop operations, do the arithmetic operation and again pushed the resultant into the stack

4. finally, perform a pop operation and print the popped value as the final result.

Code: https://ide.geeksforgeeks.org/k906uWSOei

Time complexity of evaluation algorithm is $O(n)$ where n is the number of characters in input expression.

Related questions

2 votes
2 votes
1 answer
1
0 votes
0 votes
1 answer
3
prasitamukherjee asked Jul 16, 2015
559 views
q.26 : I do not understand the output . Why are real , integer and to coming?
2 votes
2 votes
1 answer
4
Himanshu Goyal asked Jul 14, 2017
5,506 views
How is ans 15 for this question Please can anybody solve this