Binary Trees Question List for DSA | Leetcode
2 min readMar 15, 2024
Let’s talk about binary trees and list of questions that you can do master them on Leetcode. Here’s a comprehensive list I have curated for practice and to learn and revise Binary Trees ( Binary Search Tree included :))
Traversals:
- Inorder Traversal
- Preorder Traversal
- Postorder Traversal
- Level Order Traversal
- Zigzag Level Order Traversal
- N-ary tree Level Order Traversal
Lengths and Depths:
- Height of a tree
- Diameter of a tree
- Balanced Tree
- Maximum Width of a binary tree
- Maximum Depth of a N-ary tree
Same Trees & Sub Trees & Flip Operations:
- Same Tree
- Symmetric Tree
- Subtree of another tree
- Invert Tree
- Flip equivalent binary trees
- Find duplicate subtrees
- Merge two binary trees
- Validate BST
- Find a corresponding node of a binary tree in the clone tree
Lowest Common Ancestors:
- Lowest Common Ancestor of a binary tree
- Lowest Common Ancestor of a binary search tree
- Lowest Common Ancestor of deepest leaves
Create Tree from arrays:
- Create Binary tree from Inorder and Preorder traversal
- Create Binary tree from Inorder and Postorder traversal
- Create Binary Search tree from a sorted array
Difference in a Binary Trees:
Camera views of a tree:
Path Sums:
- Path Sum
- Range Sum in BST
- Pseudo-palindromic path in a binary tree
- Sum of Root to leaf binary tree
- Path Sum III
Flood fills:
Insertion/Deletion from a tree:
Dynamic Programming:
- Unique Binary Search Trees
- Unique Binary Search Trees II
- House Robber III
- All Possible full binary trees
Miscellaneous ( and check your skill in binary tree :)) :
- Minimum number of operations to sort a binary tree by level
- Cousins in a binary tree
- Leaf Similar trees
- Construct String from a Binary Tree
- Minimum time to collect apples in a binary tree
- Check completeness of a binary tree
- Time needed to inform all the employees
- Count good nodes in a binary tree
- Operations on a tree
Cheers. :)
( PS: This list might be incomplete. Will keep updating this post )