IUP Computer Science
CO 310 Fall 1982

Assignment #6
(Due 8 December 1982)

Write a program that reads a fully parenthesized expression and creates a binary tree to represent it. The expression contains no more than 50 characters. Variables in the expression consist of a single letter. The operators are +, -, *, /, and $. There are no embedded blanks in the expression. After creating the binary tree, do a preorder traversal of the tree and print the equivalent prefix expression. Also, do a postorder traversal of the tree and print the equivalent postfix expression. The following is an example.

Original expression ((A*(B+C))/(D-E))

Prefix: /*A+BC-DE 

Postfix: ABC+*DE-/

The data for the program must be read from the terminal or the JCL file. You should use the following expressions as data. The spacing in the data below is only for readability - the program's data should have no spaces.
( A * B )
( ( A + B > / ( A - B ) )
( ( E $ F ) - ( ( ( A * B ) / C ) + D ) )
( ( ( A / B ) + ( C - D ) ) * ( ( E + F ) $ G * H ) ) 
( ( ( A $ B ) + C ) + ( R * S ) )
Grading will be based on documentation, output, and the use of a tree structure. Hand written documentation will not be accepted.