485 views
0 votes
0 votes

While evaluating the expression tree, if the left or right child is not present then the value of that particular missing child is taken as 0?

Have a look at this question

In my evaluation, I am getting: ( (a-0) - b ) - 0 + e! = a-b+e!

Answer is given as option c but by this approach, I am getting option (d) as the answer.

1 Answer

0 votes
0 votes
On solving this expression we got a+b+e!

On putting a=-b and e=0 we got 0! Which is equals to 1. So option 1 is correct

On putting a=-b and e=1 we got 1! Which is eauals to 1. So option 2 is correct,

Hence 1 and 2 are correct

So the answer is (c).

Related questions

1 votes
1 votes
0 answers
1
iarnav asked Nov 19, 2017
632 views
To evaluate an expression with any embedded function call at any time how many stacks are needed?
2 votes
2 votes
1 answer
2
shekhar chauhan asked Jul 14, 2016
1,684 views
If we have to construct the expression tree from this expression (3 + ((5+9)*2)) then what will be the order of push and pop operation on a stack ?Explain what to do with...
0 votes
0 votes
1 answer
3
4 votes
4 votes
2 answers
4