[Tutor] Binary tree expressions

Quiles, Stephanie stephanie.quiles001 at albright.edu
Tue Aug 18 16:36:37 CEST 2015


Hello! 

Not sure if anyone can help me with these or not but here it goes... 

I have to draw an expression tree for the following (a+b)*c-(d-e). 

I believe that the last move would go first in the tree so in this case you would subtract c after computing what d-e was. So my tree would start out looking like this :

     (-)
     / \
   (+)  (-)
   / \   / \

Sorry not sure how to better draw that... 

Is that correct so far? Where do I go from there if I am? The c is really throwing me off here. 

Here's the other tree: 
((a+b) *c-(d-e)) ^ (f+g)

So for this one you would do everything in the double parentheses first so a+b and d-e then multiple the sum of a+b by c 
Then I would subtract c from the sum of d-e. 

Then I would look at the right side and add f+g 

Finally I would calculate the sum of the left side  ^ of the sum of f+g. 
So my tree would start with the ^ its children would be * (left child) + (right child) 
Is that right so far?

Thanks for your help in advance! The tutorials online are not quite as complicated so I get consider once you start adding in more operators. 



Stephanie Quiles
Sent from my iPhone


More information about the Tutor mailing list