Showing Posts From
Trees
- 22 Dec, 2025
Advanced Binary Tree & BST
Week 22 notes: the harder tree problems, where a node has to report several facts to its parent at once. The return-tuple DFS pattern, lowest common ancestor, path sums, and serialize/deserialize.
- 20 Oct, 2025
N-ary Trees: Traversal & Encoding
Week 13 notes: once a node can have any number of children, the binary-tree patterns still work, you just loop over children. Plus encoding an N-ary tree as a binary one.
- 13 Oct, 2025
Tries: Prefix Trees for Fast Lookups
Week 12 notes: a trie stores strings by shared prefixes, so lookup and prefix search depend on word length, not how many words you've got. Where autocomplete comes from.
- 06 Oct, 2025
Binary Search Trees: Order, Search & Balance
Week 11 notes: a BST keeps values ordered so search, insert, and delete are O(h). The invariant, why inorder comes out sorted, and why balance is everything.
- 29 Sep, 2025
Binary Trees: Traversals & DFS / BFS
Week 10 notes: binary trees are basically recursion you can draw. The three DFS orders, level-order BFS, and the one move that solves most tree problems.