Standard Questions on Binary Tree
- Validate Binary Tree: Given a binary tree, determine whether it is a valid binary search tree.
- Binary Tree Traversal: Implement various tree traversal algorithms such as pre-order, in-order, and post-order traversals. These algorithms visit nodes in different orders.
- Symmetric Binary Tree: Check whether a binary tree is symmetric, i.e., it is a mirror image of itself.
- Maximum Depth of Binary Tree: Find the maximum depth (or height) of a binary tree, which is the number of nodes along the longest path from the root node to any leaf node.
- Lowest Common Ancestor: Given two nodes in a binary tree, find their lowest common ancestor (LCA), which is the deepest node that has both nodes as descendants.
- Path Sum: Determine if there exists a root-to-leaf path in a binary tree that sums up to a given target value.
- Invert Binary Tree: Invert a binary tree by swapping the left and right child of each node.
- Serialize and Deserialize Binary Tree: Serialize a binary tree into a string representation and then deserialize it back to the original tree.
- Construct Binary Tree from Preorder and Inorder Traversal: Given the preorder and inorder traversal sequences of a binary tree, construct the binary tree.
- Binary Tree Diameter: Find the diameter of a binary tree, which is the length of the longest path between any two nodes in the tree.
These are just a few examples only.