Skip to content

Instantly share code, notes, and snippets.

@seyyah
Forked from anonymous/as10_s5c.py
Created April 12, 2011 15:07
Show Gist options
  • Save seyyah/915672 to your computer and use it in GitHub Desktop.
Save seyyah/915672 to your computer and use it in GitHub Desktop.
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