Skip to content

Instantly share code, notes, and snippets.

@tnguyen14
Forked from cjrieck/tree-orders.py
Created November 11, 2013 15:21
Show Gist options
  • Save tnguyen14/7414811 to your computer and use it in GitHub Desktop.
Save tnguyen14/7414811 to your computer and use it in GitHub Desktop.
def inorder(node):
if node.left != None:
inorder(node.left)
print node.cargo
if node.right != None:
inorder(node.right)
def preorder(node):
print node.cargo
if node.left != None:
preorder(node.left)
if node.right != None:
preorder(node.right)
def postorder(node):
if node.left != None:
postorder(node.left)
if node.right != None:
postorder(node.right)
print node.cargo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment