+1 vote
in Data Structures & Algorithms I by (110k points)
What is the value of the postfix expression  2 3 + 4 5 6 – – *

(a) 19

(b) 21

(c) -4

(d) 25

This key question is from Application of Stacks in portion Application of Stacks of Data Structures & Algorithms I

The question was asked during an internship interview.

1 Answer

+1 vote
by (408k points)
selected by
 
Best answer
Correct option is (d) 25

The best explanation: Given postfix expression : 2 3 + 4 5 6 – – *

infix ⇒ (2 + 3)4 (5 – 6) – *

⇒ (2 + 3)*4 – (5 – 6)

Hence, value = (2 + 3) * (4 – (5 – 6)) = 5 *(4 – (-1)) = 5*5 = 25.

Related questions

Welcome to TalkJarvis QnA, a question-answer community website for the people by the people. On TalkJarvis QnA you can ask your doubts, curiosity, questions and whatever going in your mind either related to studies or others. Experts and people from different fields will answer.

Categories

...