-
-
Save seyyah/915672 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def printexp(tree): | |
sVal = "" | |
if tree: | |
if tree.left == None and tree.right == None: return str(tree.getRootVal()) | |
sVal = '(' + printexp(tree.getLeftChild()) | |
sVal = sVal + str(tree.getRootVal()) | |
sVal = sVal + printexp(tree.getRightChild())+')' | |
return sVal |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment