A Binary Tree is a tree data structure in which each node has at most two children, which are referred to as the left child and the right child, and the topmost node in the tree is called the root.
In this post, we have listed out commonly asked interview questions that use binary tree:
- Inorder Tree TraversalMedium
- Preorder Tree TraversalMedium
- Postorder Tree TraversalMedium
- Check if two binary trees are identical or notEasy
- Print bottom view of a binary treeMedium
- Print top view of a binary treeMedium
- In-place convert a binary tree to its sum treeEasy
- Determine whether the given binary tree nodes are cousins of each otherMedium
- Print cousins of a given node in a binary treeMedium
- Check if a binary tree is a sum tree or notMedium
- Combinations of words formed by replacing given numbers with corresponding alphabetsHard
- Determine whether a binary tree is a subtree of another binary treeMedium
- Find the diameter of a binary treeMedium
- Check if a binary tree is symmetric or notEasy
- Convert a binary tree to its mirrorEasy
- Determine if a binary tree can be converted to another by doing any number of swaps of childrenEasy
- Find the Lowest Common Ancestor (LCA) of two nodes in a binary treeMedium
- Print all paths from the root to leaf nodes of a binary treeEasy
- Find ancestors of a given node in a binary treeMedium
- Find distance between given pairs of nodes in a binary treeHard
- Find the diagonal sum of a binary treeMedium
- Sink nodes containing zero to the bottom of a binary treeHard
- Convert a binary tree to a full tree by removing half nodesMedium
- Truncate a binary tree to remove nodes that lie on a path having a sum less than
k
Medium - Find maximum sum root to leaf path in a binary treeMedium
- Check if a binary tree is height-balanced or notMedium
- Convert binary tree to Left-child right-sibling binary treeMedium
- Print all paths from leaf to root node of a binary treeMedium
- Iteratively print the leaf to root path for every leaf node in a binary treeMedium
- Build a binary tree from a parent arrayHard
- Find all nodes at a given distance from leaf nodes in a binary treeHard
- Count all subtrees having the same value of nodes in a binary treeMedium
- Find the maximum difference between a node and its descendants in a binary treeMedium
- Find the maximum sum path between two leaves in a binary treeHard
- Construct a binary tree from inorder and preorder traversalHard
- Construct a binary tree from inorder and postorder traversalsHard
- Construct a binary tree from inorder and level order sequenceHard
- Construct a full binary tree from the preorder sequence with leaf node informationHard
- Construct a full binary tree from a preorder and postorder sequenceHard
- Find postorder traversal of a binary tree from its inorder and preorder sequenceMedium
- Set next pointer to the inorder successor of all nodes in a binary treeEasy
- Find preorder traversal of a binary tree from its inorder and postorder sequenceHard
- Find difference between sum of all nodes present at odd and even levels in a binary treeEasy
- Clone a binary tree with random pointersHard
- Threaded Binary Tree – Overview and ImplementationMedium
- Determine if a binary tree satisfies the height-balanced property of a red–black treeMedium
- Construct an ancestor matrix from a binary treeEasy
- Find all possible binary trees having the same inorder traversalHard
- Perform boundary traversal on a binary treeMedium
- Check if each node of a binary tree has exactly one childEasy
- Evaluate a Binary Expression TreeEasy
- Construction of an expression treeEasy
- Fix children-sum property in a binary treeMedium
- Maximum path sum in a binary treeHard
- Create a mirror of an m–ary treeEasy
- Print a two-dimensional view of a binary treeEasy
- Construct a binary tree from an ancestor matrixHard
- Determine whether a given binary tree is a BST or notMedium
- Find inorder successor for the given key in a BSTMedium
- Fix a binary tree that is only one swap away from becoming a BSTHard
- Find the size of the largest BST in a binary treeHard
- Print binary tree structure with its contents in C++Medium
- Maximum Independent Set ProblemMedium
- Huffman Coding Compression AlgorithmHard
- Construct a Cartesian tree from an inorder traversalMedium
- Calculate the height of a binary tree with leaf nodes forming a circular doubly linked listMedium
- Link nodes present in each level of a binary tree in the form of a linked listHard
- Convert a ternary tree to a doubly-linked listMedium
- Extract leaves of a binary tree into a doubly-linked listMedium
- Find the vertical sum of a binary treeHard
- In-place convert a binary tree to a doubly-linked listHard
- Check whether the leaf traversal of given binary trees is the same or notHard
- Efficiently print all nodes between two given levels in a binary treeEasy
- Calculate the height of a binary treeEasy
- Delete a binary treeEasy
- Level order traversal of a binary treeEasy
- Spiral order traversal of a binary treeMedium
- Reverse level order traversal of a binary treeEasy
- Print all nodes of a perfect binary tree in a specific orderHard
- Print left view of a binary treeEasy
- Find the next node at the same level as the given node in a binary treeMedium
- Check if a binary tree is a complete binary tree or notMedium
- Print diagonal traversal of a binary treeMedium
- Print corner nodes of every level in a binary treeEasy
- Invert Binary TreeEasy
- Convert a binary tree into a doubly-linked list in spiral orderHard
- Check if a binary tree is a min-heap or notMedium
- Invert alternate levels of a perfect binary treeHard
- Perform vertical traversal of a binary treeMedium
- Compute the maximum number of nodes at any level in a binary treeEasy
- Print right view of a binary treeMedium
- Find the minimum depth of a binary treeEasy
- Depth-First Search (DFS) vs Breadth-First Search (BFS)Beginner
- Print nodes of a binary tree in vertical orderMedium
Also See:
Binary Search Tree (BST) – Interview Questions and Practice Problems
Thanks for reading.
To share your code in the comments, please use our online compiler that supports C, C++, Java, Python, JavaScript, C#, PHP, and many more popular programming languages.
Like us? Refer us to your friends and support our growth. Happy coding :)