Binary Tree Concepts | Binary Tree Tricks
Traversals
- DFS:
- BSF / Level Order:
- Other:
Searching | Checking | Counting
- Searching a Node in Binary Tree
- Depth / Height:
- Maximum Depth of Binary Tree * | Minimum Depth of Binary Tree
- Diameter of Binary Tree ^ / Longest Path in Binary Tree
- Balanced Binary Tree ^
- Same / Mirror / Symmetric / Subtree:
- Count Univalue Subtrees | Count Full nodes in a Binary tree
- Leaf Nodes: Print all leaf nodes of a Binary Tree | Count leaf nodes
- Count Good Nodes in a Binary Tree ^
Construction / Reconstruction / Conversion & Serialization / Deserialization
- Construct Binary Tree from Preorder and Inorder Traversal * |
- Construct Binary Tree from Inorder and Postorder Traversal |
- Construct Binary Tree from Preorder and Postorder Traversal |
- Construct Binary Tree from String | Convert Binary Tree To Doubly Linked List |
- Convert a Binary Tree into its Mirror Tree | Flatten Binary Tree to Linked List |
- Convert an N-ary tree to Binary tree
- Connect nodes of Tree
- Invert Binary Tree * | Binary Tree Upside Down | Merge Two Binary Trees |
- Serialize and Deserialize Binary Tree * |
- Reconstruct A Binary Tree From Traversal Data |
- Reconstruct A Binary Tree From A Preorder Traversal With Markers |
- Form A Linked List From The Leaves Of A Binary Tree
Path Problems
- Root to Node Path | Binary Tree Paths | Sum Root to Leaf Numbers | Longest Univalue Path
- Path Sum | Path Sum II Path Sum III | Path Sum IV
- Binary Tree Maximum Path Sum * | Path with given sequence
LCA
- Lowest Common Ancestor of a Binary Tree (No Parent) |
- Lowest Common Ancestor of a Binary Tree (With parent) |
- Lowest Common Ancestor of a Binary Tree (Using RMQ) |
- Lowest Common Ancestor of a Binary Tree II
- Find distance between two nodes of a Binary Tree
Misc
- Verify Preorder Serialization of a Binary Tree | Level Order Successor
- Distance of a node from the root | Binary Tree Pruning
- Compute the kth node in an inorder traversal | Find Duplicate Subtrees
- Compute the inorder successor | Maximum Binary Tree
- Delete zero sum sub-trees | Implement Locking In A Binary Tree
- Maximum Average Subtree | All Nodes Distance K in Binary Tree