next up previous
Next: Implement a tree Up: Assignment 8: Trees Previous: Build the expression tree

Generate infix

  1. Create a Translator object that contains a postfix expression and that provides a method named translate that returns an equivalent infix expression as a String.

    As a rough draft of this method, you can just do an inorder traversal, but then you will have to figure out when it is necessary to insert parentheses to preserve the value of the expression.



Allen Downey
Mon Nov 13 09:08:51 EST 2000