Status: Tags: Links: Binary Tree
Binary Tree Traversal
Orders
InOrder traversal
Left-to-right
- First visit the left subtree,
- Then the root,
- Then the right subtree.
Example:
|
|
preOrder Traversal
Pre implies the one before comes first, meaning root comes first PreOrder traversal:
- First visit the root,
- Then the left subtree,
- Then the right subtree.
Example:
|
|
Post Order Traversal
Order (root) is post
PostOrder traversal:
- First visit the left subtree,
- Then the right subtree.
- Then the root
Example:
|
|
Implementations
- Depth first search is used with a stack to process notes until the branch ends, used for nearest solutions
- Breadth First Search
- T
Backlinks
|
|
References:
Created:: 2021-11-10 14:53