
David W. answered 01/01/17
Tutor
4.7
(90)
Experienced Prof
Postfix means: <operand><operand><operator>
When scanning a tree, it means <left subtree><right subtree><node>
[note: this is recursive]
Using PEMDAS, this is:
a*b/c+d [multiply a*b to get R1 (Result1); rescan]
R1/c+d [divide R1/c to get R2; rescan]
R2+d [add R2+d to get R, the answer]
R3
In an outline form (each node has a value which may be the result of an operation on its subtrees):
R3 - Add R2+d
R2 - Divide R1/c
R1 - Multiply a*b
a - leaf; a value
b - leaf; a value
c - leaf; a value
d - leaf; a value
R3 is <R2>d+ Add R2+d
R3 is <R1>c/d+ Expand R2
R3 is ab*c/d+ Expand R1 [note of interest: PostScript is a printer language (processor, ROM with program, and RAM) that also has software emulators.]