R> Convert these postfix to infix:
R> ABCD-/+
R> AB-C/D+
R> AX+Y+UV-/
R> AX+Y+U/V-
R>
R>
R> Convert these infix to postfix:
R> A*(S+Y/W)/(U-V)
R> A-B-C+W
R> A*(B-Y-X-E)/(F+G)
R> A-B/C-D*E/F/G
One common answer is to use a recursive decent parser to build
an expression tree.
Another method is to use an operator precedence table and a stack
to convert.
Both methods are a bit complex and require either a pre-exsisting
stack or unsorted binary tree.
--- GEcho 1.00
---------------
* Origin: Digital OnLine Magazine! - (409)838-8237 (1:3811/350)
|