1.

Consider the postfix expression 4 5 6 a b 7 8 a c, where a, b, c are operators. Operator a has higher precedence over operators b and c. Operators b and c are right associative. Then, equivalent infix expression is(a) 4 a 5 6b 7 8 a c(b) 4 a 5 c 6 b 7 a 8(c) 4 b 5 a 6 c 7 a 8(d) 4 a 5 b 6 c 7 a 8This intriguing question comes from Application of Stacks topic in chapter Application of Stacks of Data Structures & Algorithms II had been asked this question during an online exam.

Answer»

Correct choice: (c) 4 b 5 a 6 c 7 a 8

Given POSTFIX EXPRESSION: 4 5 6 a b 7 8 a c

INFIX ⇒ 4 (5 a 6)b (7 a 8)c

⇒ (4 b (5 a 6)) (7 a 8)c

⇒ (4 b (5 a 6)) c (7 a 8)

So, the required infix expression is 4 b 5 a 6 c 7 a 8.



Discussion

No Comment Found

Related InterviewSolutions