Binary Tree Study Guide
Tree Types
Binary trees come in several variations, each with unique properties:
- Complete Binary Tree (CBT): Every level is filled, except possibly the last, which is filled from left to right.
- Perfect Binary Tree (PBT): All interior nodes have two children, and all leaf nodes are at the same level.
- Full Binary Tree (FBT): Every node has either 0 or 2 children.
- Binary Search Tree (BST): For each node, all elements in the left subtree are less than the node, and all elements in the right subtree are greater.
Tree Traversal
Understanding different traversal methods is crucial for working with binary trees:
- Inorder Traversal: Left subtree, Root, Right subtree
- Preorder Traversal: Root, Left subtree, Right subtree
- Postorder Traversal: Left subtree, Right subtree, Root
- Level Order Traversal: Visit nodes level by level, from left to right
Tree Properties and Operations
This section covers various properties and operations on binary trees:
Tree Depth/Width
Tree Paths
Tree Structure Modification
Tree Construction
Tree Validation
Special Problems
This section covers unique problem types related to binary trees:
Lowest Common Ancestor
Tree View Problems
Serialization and Deserialization
Node Deletion
Tree and Linked List Combination
Problem Difficulty Legend
- 🟩 Easy
- 🟨 Medium
- 🟧 Medium-Hard
- 🟥 Hard
- ⬛ Very Hard
Additional Resources