# 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

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 6  b 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 8

This intriguing question comes from Application of Stacks topic in chapter Application of Stacks of Data Structures & Algorithms I

+1 vote
by (88.7k points)
selected by

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.

+1 vote
+1 vote
+1 vote
+1 vote
+1 vote
+1 vote
+1 vote
+1 vote
+1 vote
+1 vote
+1 vote
+1 vote