CIS 125

22 – Applications 1

 

 

In exercises 1-7, re-write (and re-group using appropriate parens) the expression, and draw it’s binary tree.

 

1.         A + B

 

 

 

 

 

 

2.         A + B * C

 

 

 

 

 

 

3.         A * B + C

 

 

 

 

 

 

4.         B – D

 

 

 

 

 

 

5.         A * B – D

 

 

 

 

 

 

6.         A / C

 

 

 

 

 

 

7.         B – A / C

 

 

 

 

 

 

 

In exercises 8-10, represent (draw) the expression as a binary tree and write the postfix/postorder notation forms of the expression.

 

8.         ( A + B ) * ( C – D )

 

 

 

 

 

 

 

 

 

 

 

 

9.         ( ( A – C ) * D ) / ( A + ( B + D ) )

 

 

 

 

 

 

 

 

 

 

 

 

10.       ( A * B + C * D ) - ( A / B - ( D + E ) )