Lesson 15 · Python
Data Structures: Trees & Graphs
Organize hierarchical and connected data: binary search trees with three traversal orders, graphs as adjacency lists, and BFS and DFS exploration.
Prerequisites: Data Structures: Stacks, Queues & Hash Maps
Learning objectives
By the end of this lesson, you will be able to:
- Use tree vocabulary precisely: root, leaf, depth, height, subtree
- Insert and search in a binary search tree, relying on its ordering property
- Walk a tree in pre-order, in-order and post-order
- Represent graphs as adjacency lists, a dict of lists
- Find shortest paths in unweighted graphs with BFS and explore with recursive DFS