edited by
12,852 views

6 Answers

Best answer
51 votes
51 votes
We have to keep symbol into stack and when we get two operands followed by operator. We will apply operator on last two operands.$$\begin{array}{|ll|}\hline \textbf{symbol}  &  \textbf{stack } \\\hline \text{10} & \text{10 $\quad$ (keep in stack)}\\\hline \text{5} & \text{10 $\quad$ 5 $\quad$ (keep in stack)}\\\hline
\text{+} & \text{10 $\quad$ 5 $\quad$ + $\quad$ (apply operator on last 2 operands $\implies 10+5=15)$}\\\hline \text{60} & \text{15 $\quad$ 60 $\quad$ (keep in stack)}\\\hline  \text{6} & \text{15 $\quad$ 60 $\quad$ 6 $\quad$ (keep in stack)}\\\hline  
\text{/} & \text{15 $\quad$ 60 $\quad$ 6 $\quad$ / $\quad$ (apply operator on last 2 operands $\implies 60/6=10)$}\\\hline  
\text{*} & \text{15 $\quad$ 10 $\quad$ * $\quad$ (apply operator on last 2 operands $\implies  10*15=150)$}\\\hline   \text{8} & \text{150 $\quad$ 8 $\quad$ (keep in stack)}\\\hline   - & \text{150 $\quad$ 8 $\quad -\quad$ (apply operator on last 2 operands $\implies 50-8=142)$}\\\hline  \end{array}$$

So, answer is $142$.
edited by
18 votes
18 votes
(10 + 5) * (60 / 6) - 8 = 15 * 10 - 8 = 142
4 votes
4 votes

10 5 + 60 6 / * 8 -

Operation  Symbol Stack
  10 5 + 60 6 / * 8 - NULL
Push 5 + 60 6 / * 8 -   10
Push         + 60 6 / * 8 -   10 5
Pop 60 6 / * 8 - (10 + 5)
Push 6 / * 8 - (10 + 5) 60
Push / * 8 - (10 + 5) 60 6
Pop * 8 - (10 + 5) (60/6)
Pop 8- (10 + 5) * (60/6)
Push - [(10 + 5) * (60/6)]  8
Pop Null [(10 + 5) * (60/6)]  - 8

So after evaluation of    [(10 + 5) * (60/6)]  - 8 = 142 so option c is answer

2 votes
2 votes

This postfix expression can be evaluated using stack..

                                6

           5            60   60  10            8

    10  10    15  15   15  15   150   150     142

    10    5    +    60    6     /     *        8         -

Answer will be 142.

Answer:

Related questions

42 votes
42 votes
12 answers
1
go_editor asked Feb 14, 2015
23,857 views
Consider a binary tree T that has $200$ leaf nodes. Then the number of nodes in T that have exactly two children are ______.
32 votes
32 votes
4 answers
2
go_editor asked Feb 14, 2015
8,955 views
Consider the following array of elements.$\langle 89, 19, 50, 17, 12, 15, 2, 5, 7, 11, 6, 9, 100 \rangle$The minimum number of interchanges needed to convert it into a ma...
36 votes
36 votes
4 answers
3
go_editor asked Feb 14, 2015
9,214 views
Given that hash table $T$ with $25$ slots that stores $2000$ elements, the load factor $a$ for $T$ is _________.
25 votes
25 votes
8 answers
4
go_editor asked Feb 14, 2015
7,265 views
While inserting the elements $71, 65, 84, 69, 67, 83$ in an empty binary search tree (BST) in the sequence shown, the element in the lowest level is$65$$67$$69$$83$