Home Index

1. Binary Search Tree

2. Traversal

Binary Search Tree / Traversal /

Binary Search Tree = O(log n)

Inorder Traversal

Nodes are access in sorted order
1 2 3 4 5 6 7 8 9

Preorder Traversal

Start in the Root, move to left keep going left until leaf node.
Traverse all the way back to root
Continue the same thing on right side of the tree.

Postorder Traversal

Start with left most node in left subtree continue visiting each leaf node in left subtree.
End up in Root node and do the same thing in right subtree.