Binary Tree Traversals

A fixed, non-trivial 9-node binary tree is already built for you (root). Implement preorder(node), inorder(node) and postorder(node), each returning a list of values in the correct order.

Read a choice ("pre", "in" or "post") and print the corresponding traversal's values, space-separated.

main.py
Loading editor…

Console

Run your code to see output here.