Notes for assignment # 3
Instead of the Expression class use BXTree class discussed in LEC10.DOC and LEC11.DOC
Ignore 33(d) and 33(e)
For part (a) write a member function for
BXTree called fullParanthesis(). It will be a recursive
function similar to InOrder traversal. You don't need any
parameters.
Algorithm for the private version (with one parameter)
will be:
if(!t) return;
if(t->data.IsOperator())cout << " ( ";
fullParanthesis(t->LeftChild);
cout << ' ' << t->data << ' ';
fullParanthesis(t->RightChild);
cout << " ) ";else
cout << ' ' << t->data << ' ' << endl;
Main program accepts a prefix expression outputs its postfix and fully parathesized infix equivalent as well as the value.