Skip to content

Instantly share code, notes, and snippets.

@fogonthedowns
Created October 14, 2016 20:33
Show Gist options
  • Select an option

  • Save fogonthedowns/776bc6b5861cdc0afaac89f2656f140e to your computer and use it in GitHub Desktop.

Select an option

Save fogonthedowns/776bc6b5861cdc0afaac89f2656f140e to your computer and use it in GitHub Desktop.
parse tree
def parse_tree(tree, path):
path = path
path.append(str(tree.get_id()))
if tree.is_leaf() is False:
right = tree.get_right()
parse_tree(right, path)
left = tree.get_left()
parse_tree(left, path)
else:
print(('.').join(path))
parse_tree(a, [])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment