mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-24 13:24:05 -06:00
565 B
565 B
| title | aliases | tags | |
|---|---|---|---|
| tree-traversal | traversal |
|
Visit each node in the tree once. So we need to visit n, all the nodes in L, and all the nodes in R. We can do this in four different ways
preorder
- visit n
- traverse L
- traverse R
Inorder.
- traverse L
- visit n
- traverse R Creating an BST from an array using the add operation then doing an inorder traversal is effectively a quicksort
postorder
- traverse L
- traverse R
- visit n
level order
- vist the root
- visit the roots children
- visit their children
- etc