Exit Slides

Tree Traversal

overview

Summary

tree_traversal visits all nodes of a tree in a specific order. Two main families are depth_first_search and breadth_first_search. pre_order, in_order, and post_order are depth_first_search variants. level_order is the breadth_first_search variant. depth_first_search often uses recursion or a stack. breadth_first_search uses a queue. A binary_tree has a root with left and right links. Order refers to when the node is visited relative to its children. Remember the names and basic patterns.
← Prev Topic Slide 1 / 3 Next Topic: Level Order Traversal →