Skip to content

Commit 5be5bd1

Browse files
committed
Add class 10 topics, resources, and challenges: trees traversals
1 parent db29d2c commit 5be5bd1

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed

Class10.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
## Class 10: Tree Traversals
2+
3+
### Topics
4+
- [Tree traversal]
5+
- [Depth-first search]: pre-order, post-order, in-order traversal
6+
- [Breadth-first search]: level-order traversal
7+
8+
### Resources
9+
- Review Make School's [tree traversal slides]
10+
- Watch Make School's [tree traversal video lecture]
11+
- Read Interview Cake's articles on [depth-first search][IC DFS], [breadth-first search][IC BFS], and [binary tree properties][IC binary tree]
12+
- Watch HackerRank's [trees and binary search tree video][HR trees video] (traversals start at 3:00)
13+
- Watch Harvards's [family trees and binary search tree video][Harvard trees video] and [stack frames video]
14+
- Play with VisuAlgo's [interactive binary search tree visualization][visualgo bst]
15+
16+
### Challenges
17+
- Implement tree traversal methods on the `BinarySearchTree` class using [binary tree starter code]:
18+
- `_traverse_in_order_recursive` - traverse the tree with recursive in-order traversal (DFS)
19+
- `_traverse_pre_order_recursive` - traverse the tree with recursive pre-order traversal (DFS)
20+
- `_traverse_post_order_recursive` - traverse the tree with recursive post-order traversal (DFS)
21+
- `_traverse_level_order_iterative` - traverse the tree with iterative level-order traversal (BFS)
22+
- Annotate tree traversal methods with complexity analysis of running time and space (memory)
23+
- Run `python binarytree.py` to test `BinarySearchTree` traversal methods on a small example
24+
- Run `pytest binarytree_test.py` to run the [binary tree unit tests] and fix any failures
25+
26+
### Stretch Challenges
27+
- Implement iterative tree traversal methods on the `BinarySearchTree` class (*without using recursion*):
28+
- `_traverse_in_order_iterative` - traverse the tree with iterative in-order traversal (DFS)
29+
- `_traverse_pre_order_iterative` - traverse the tree with iterative pre-order traversal (DFS)
30+
- `_traverse_post_order_iterative` - traverse the tree with iterative post-order traversal (DFS)
31+
- Annotate tree traversal methods with complexity analysis of running time and space (memory)
32+
33+
34+
[tree traversal]: https://en.wikipedia.org/wiki/Tree_traversal
35+
[depth-first search]: https://en.wikipedia.org/wiki/Depth-first_search
36+
[breadth-first search]: https://en.wikipedia.org/wiki/Breadth-first_search
37+
38+
[tree traversal slides]: slides/TreeTraversals.pdf
39+
[tree traversal video lecture]: https://www.youtube.com/watch?v=Qd8dKFaRu9I
40+
[HR trees video]: https://www.youtube.com/watch?v=oSWTXtMglKE
41+
[HR bst interview problem]: https://www.youtube.com/watch?v=i_Q0v_Ct5lY
42+
[Harvard trees video]: https://www.youtube.com/watch?v=mFptHjTT3l8
43+
[stack frames video]: https://www.youtube.com/watch?v=beqqGIdabrE
44+
[IC BFS]: https://www.interviewcake.com/concept/python/bfs
45+
[IC DFS]: https://www.interviewcake.com/concept/python/dfs
46+
[IC binary tree]: https://www.interviewcake.com/concept/python/binary-tree
47+
[visualgo bst]: https://visualgo.net/bst
48+
49+
[binary tree starter code]: source/binarytree.py
50+
[binary tree unit tests]: source/binarytree_test.py

ReadMe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
| 7 | Monday, November 6 | [Maps & Hash Tables](Class7.md) |
1919
| 8 | Wednesday, November 8 | [Sets & Circular Buffers](Class8.md) |
2020
| 9 | Friday, November 10 | [Trees & Binary Search Trees](Class9.md) |
21-
| 10 | Monday, November 13 | Tree Traversals |
21+
| 10 | Monday, November 13 | [Tree Traversals](Class10.md) |
2222
| 11 | Wednesday, November 15 | Iterative Sorting Algorithms |
2323
| 12 | Friday, November 17 | Integer Sorting Algorithms |
2424
| 13 | Monday, November 27 | Divide-and-Conquer Recursion |

0 commit comments

Comments
 (0)