Find 14 different expression trees a b divide c times d e
Find 14 different expression trees a + b divide c times d - e Also write the polish and reverse polish notation of each.
Solution
Solution: given expression is a+b/c*d-e
14 diffrent tree is (a+b/c)*d-e, a+b/(c*d)-e, a+b/c*(d-e), a-b/c*d-e, a-b/c*d+e, a+b/d*c-e, a-b/d*c-e, a-b/d*c+e, (a-b/d)*c-e, a-b/d*(c-e), a+b/d*(c-e), a-b/d*(c+e), (a-b)/c*d-e, (a-b)/d*c-e
polish notation are +*-a b c d e, + - * a b c d e, - + * a b c d e, +a-b c d*e, *a+-b c d e, -a+b c d * e, * + a b - c d e
reverse polish notation are a b c d e + -*, a b c d + e - *, a b c + d e -*, a b c d * e - +, b c e * c a + -
