Mark As Completed Discussion

Postorder traversal

  1. Visit all the nodes in the left subtree
  2. Visit all the nodes in the right subtree
  3. Visit the root node

When to use? You can use post-order traversal to delete a tree, since you can delete all of a node's children before itself.

SNIPPET
1postorder(root.left)
2postorder(root.right)
3display(root.data)
Step Four
JAVASCRIPT
OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment