GATE | GATE-CS-2004 | Question 90
Assume that the operators +, -, × are left associative and ^ is right associative. The order of precedence (from highest to lowest) is ^, x , +, -. The postfix expression corresponding to the infix expression a + b × c – d ^ e ^ f is
(A) abc × + def ^ ^ –
(B) abc × + de ^ f ^ –
(C) ab + c × d – e ^ f ^
(D) – + a × bc ^ ^ def
Answer: (A)
Explanation: ^ is right assosciative.
See http://geeksquiz.com/stack-set-2-infix-to-postfix/
This solution is contributed by parul Sharma.
Quiz of this Question
Please Login to comment...