4 votes 4 votes Compute the postfix equivalent of the following infix arithmetic expression $a + b \ast c + d * e \uparrow f$ where $\uparrow$ represents exponentiation. Assume normal operator precedences. DS gate1989 descriptive data-structures stack infix-prefix + – makhdoom ghaya asked Nov 29, 2016 • edited Apr 16, 2021 by Lakshman Bhaiya makhdoom ghaya 1.9k views answer comment Share Follow See all 2 Comments See all 2 2 Comments reply Lokesh . commented Nov 30, 2016 reply Follow Share is that postfix equivalent?? 1 votes 1 votes chirudeepnamini commented Oct 25, 2019 reply Follow Share Draw the expression tree and do postorder traversal. This will give post fix expression. 0 votes 0 votes Please log in or register to add a comment.
Best answer 13 votes 13 votes $=a+(bc*)+(d(ef↑)*)$ $=(abc*+)+(def↑*)$ $=abc*+def↑*+$ Aboveallplayer answered Nov 29, 2016 • edited Jul 7, 2019 by Arjun Aboveallplayer comment Share Follow See all 3 Comments See all 3 3 Comments reply KUSHAGRA गुप्ता commented Feb 28, 2020 reply Follow Share Can also be solved by making use of Operator Stack. 2 votes 2 votes samir757 commented Jan 10, 2022 reply Follow Share abc*def↑**+ 0 votes 0 votes sk91 commented Aug 24, 2022 reply Follow Share Hi @samir757 firstly, abc*def↑**+ is not correct. It has three ‘*’s in it but input infix expression has only 2 ‘*’s Even if we assume it as a typo and second last char as ‘+’ getting abc*def↑*++, then its still wrong Postfix expression abc*def↑*++ assumes ‘+’ is right associative. But , in C, ‘+’ is left associative For C operator precedence table, kindly refer the following link https://en.cppreference.com/w/c/language/operator_precedence 0 votes 0 votes Please log in or register to add a comment.