retagged by
15,747 views
44 votes
44 votes
Compute the post fix equivalent of the following expression $3^*\log(x+1)-\frac{a}{2}$
retagged by

9 Answers

2 votes
2 votes

Why to go for long description, draw tree and enjoy what you want prefix, infix postfix or even converse pre, in and post.

 

Once go from my ans.

0 votes
0 votes

we know that in infix expression, operator that is being evaluated at last is root.

Therefore,  3∗log(x+1)−a/2 infix expression can be shown in tree as-

- is evaluated at last here, so we can write it at first in tree, hence the root.

Similarly for other operators like

(x+1) is evaluated at very first therefore we can write it at last in the below tree.

                  

Now traverse it in postfix fashion like Left Right Root, we can get the following postfix expression as:

 

3x1+log∗a2/−

Related questions

4 votes
4 votes
1 answer
1
makhdoom ghaya asked Nov 29, 2016
1,917 views
Compute the postfix equivalent of the following infix arithmetic expression$a + b \ast c + d * e \uparrow f$where $\uparrow$ represents exponentiation. Assume normal ope...
28 votes
28 votes
3 answers
2
Kathleen asked Sep 29, 2014
8,639 views
Which of the following is essential for converting an infix expression to the postfix form efficiently?An operator stackAn operand stackAn operand stack and an operator s...
33 votes
33 votes
4 answers
3
32 votes
32 votes
5 answers
4
Kathleen asked Sep 18, 2014
12,883 views
Assume that the operators $+, -, \times$ are left associative and $^\hat{}$ is right associative. The order of precedence (from highest to lowest) is $ \ ^\hat{}, \times,...