Construct a binary expression tree for the given mathematical expression.
(((3− 2)×3) ÷ (((2×1) − (4 ÷ 2))× 2)) + ((4 − 2) ÷1)
Answers
Answered by
0
Answer:
Let t be the expression tree
If t is not null then
If t.value is operand then
Return t.value
A = solve(t.left)
B = solve(t.right)
// calculate applies operator 't.value'
// on A and B, and returns value
Return calculate(A, B, t.value)
Answered by
0
Explanation:
(((3− 2)×3) ÷ (((2×1) − (4 ÷ 2))× 2)) + ((4 − 2)÷1)
((1×3) ÷ (( 2- 2×2) + (2÷1)
3÷ ( 2-4)+2 = 3÷ (-2)+2 = -3/2 +2 = ( -3+2)/2 = -1/2 Ans.
Similar questions