Binary Tree Interview Questions and Practice Problems

 
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 list out commonly asked interview questions that uses binary tree –

 

  1. Check if two given binary trees are identical or not | Iterative & Recursive
     
  2. Calculate height of a binary tree | Iterative & Recursive
     
  3. Delete given Binary Tree | Iterative & Recursive
     
  4. Inorder Tree Traversal | Iterative & Recursive
     
  5. Preorder Tree Traversal | Iterative & Recursive
     
  6. Postorder Tree Traversal | Iterative & Recursive
     
  7. Level Order Traversal of Binary Tree
     
  8. Spiral Order Traversal of Binary Tree
     
  9. Reverse Level Order Traversal of Binary Tree
     
  10. Print all nodes of a given binary tree in specific order
     
  11. Print left view of binary tree
     
  12. Print Bottom View of Binary Tree
     
  13. Print Top View of Binary Tree
     
  14. Find next node in same level for given node in a binary tree
     
  15. Check if given binary tree is complete binary tree or not
     
  16. Determine if given two nodes are cousins of each other
     
  17. Print cousins of given node in a binary tree
     
  18. In-place convert given binary tree to its sum tree
     
  19. Check if given binary tree is a sum tree or not
     
  20. Combinations of words formed by replacing given numbers with corresponding alphabets
     
  21. Determine if given binary tree is a subtree of another binary tree or not
     
  22. Find diameter of a binary tree
     
  23. Check if given binary Tree has symmetric structure or not
     
  24. Convert binary tree to its mirror
     
  25. Check if binary tree can be converted to another by doing any no. of swaps of left & right child
     
  26. Find Lowest Common Ancestor (LCA) of two nodes in a binary tree
     
  27. Print all paths from root to leaf nodes in given binary tree
     
  28. Find ancestors of given node in a Binary Tree
     
  29. Find the distance between given pairs of nodes in a binary tree
     
  30. Find Vertical Sum in a given Binary Tree
     
  31. Print nodes in vertical order of a given Binary Tree (Vertical Traversal)
     
  32. Find the diagonal sum of given binary tree
     
  33. Print Diagonal Traversal of Binary Tree
     
  34. Print corner nodes of every level in binary tree
     
  35. In-place convert given Binary Tree to Doubly Linked List
     
  36. Sink nodes containing zero to the bottom of the binary tree
     
  37. Convert given binary tree to full tree by removing half nodes
     
  38. Truncate given binary tree to remove nodes which lie on a path having sum less than K
     
  39. Find maximum sum root-to-leaf path in a binary tree
     
  40. Check if given binary tree is height balanced or not
     
  41. Convert normal binary tree to Left-child right-sibling binary tree
     
  42. Determine if given Binary Tree is a BST or not
     
  43. Convert a Binary Tree to BST by maintaining its original structure
     
  44. Invert given Binary Tree | Recursive and Iterative solution
     
  45. Print Right View of a Binary Tree
     
  46. Print leaf to root path for every leaf node in a binary tree
     
  47. Find maximum width of given binary tree
     
  48. Build Binary Tree from given Parent array
     
  49. C++ Program to Print Binary Tree Structure
     
  50. Find all nodes at given distance from leaf nodes in a binary tree
     
  51. Count all subtrees having same value of nodes in a binary tree
     
  52. Find Maximum Difference Between a Node and its Descendants in a Binary Tree
     
  53. Construct a Binary Tree from Ancestor Matrix
     
  54. Calculate height of a binary tree with leaf nodes forming a circular doubly linked list
     
  55. Find maximum sum path between two leaves in a binary tree
     
  56. Fix a binary tree that is only one swap away from becoming a BST
     

 
 
Related Post: Binary Search Tree (BST) Interview Questions

 
 

Thank you for being with us. 🙂

 


Leave a Reply

avatar
  Subscribe  
Notify of