9 9 votes Convert the following infix expression into postfix expression:$$\texttt{a + (b - c) - d * ((e - f) / g + h)}$$Which of the following is correct?$\texttt{a b c - + d e f - g / h + * -}$ $\texttt{a b c - d e f - g / h + * - +}$ $\texttt{a b + c - d e f - g / h + * -}$ $\texttt{a b c - + d e f - g h + / * -}$ Data Structures goclasses goclasses-cs-dpp goclasses-cs-dpp-day-316 data-structures goclasses-ds-practice-questions postfix-notation infix + – GO Classes 293 views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
2 2 votes First convert the bracketed parts:$\texttt{(b - c)}\rightarrow$ $\texttt{b c -}$$\texttt{(e - f)}\rightarrow$ $\texttt{e f -}$$\texttt{(e - f) / g}\rightarrow$ $\texttt{e f - g /}$$\texttt{((e - f) / g + h)}\rightarrow$ $\texttt{e f - g / h +}$Now combine:$\texttt{a + (b - c)}$becomes:$\texttt{a b c - +}$And:$\texttt{d * ((e - f)/g + h)}$becomes:$\texttt{d e f - g / h + *}$So the complete postfix expression is:$\texttt{a b c - + d e f - g / h + * -}$Correct option : A GO Classes answered Jul 7 GO Classes comment Share Follow 0 reply Please log in or register to add a comment.
1 1 vote do first all brackets bc- , ef- then ef-g/ then ef-g/h+ now for def-g/h+*now add and subtraction have same associativity but from left to right so first addition will be formed so final A. a b c - + d e f - g / h + * - Vivid_Vivek answered Jul 7 Vivid_Vivek comment Share Follow 0 reply Please log in or register to add a comment.
0 0 votes Ans is A Vraj884 answered Jul 7 Vraj884 comment Share Follow 0 reply Please log in or register to add a comment.
0 0 votes Here is the Details Explanation Prashant-G answered Sep 15 Prashant-G comment Share Follow 0 reply Please log in or register to add a comment.