Let the leaves from left to right be denoted by x1,x2,x3,x4,x5,x6,x7,x8, where each xi∈{0,1}.
We evaluate the subtrees from the bottom up:
Left subtree of the root:
Left child of (−): x1+x2
Right child of (−): x3−x4
Left subtree expression: (x1+x2)−(x3−x4)=x1+x2−x3+x4
Right subtree of the root:
Left child of (+): x5−x6
Right child of (+): x7+x8
Right subtree expression: (x5−x6)+(x7+x8)=x5−x6+x7+x8
Root operation (+):
Total Expression=(x1+x2−x3+x4)+(x5−x6+x7+x8) Total Expression=x1+x2−x3+x4+x5−x6+x7+x8
To maximize this expression, we set all positively signed terms to 1 and all negatively signed terms to 0:
x1=1,x2=1,x4=1,x5=1,x7=1,x8=1
x3=0,x6=0
Substituting these values:
Maximum value=1+1−0+1+1−0+1+1=6