Trees Interview Questions

List of problems sorted in increasing order of difficulty:

  1. Pre-order Traversal of a Binary Tree
  2. Post-order Traversal of a Binary Tree
  3. In-order Traversal of a Binary Tree
  4. Binary Tree Level Order Traversal
  5. Print right view of a binary tree
  6. Print all nodes of a binary tree that do not have sibling
  7. Print all Root to Leaf paths of a Binary Tree
  8. Minimum Depth of a Binary Tree
  9. Print left view of a binary tree
  10. Find sum of all left leaves of a binary tree
  11. Find depth of deepest odd level leaf node
  12. Check whether a binary tree is a full binary tree or not
  13. Check whether a binary tree is complete or not
  14. Check if two nodes are cousins in a Binary tree
  15. Check if two binary trees are identical
  16. Check if all internal nodes of BST have only one child without building tree
  17. Convert the given n-ary tree to its mirror image
  18. Convert a binary tree to its mirror tree
  19. Print top view of a binary tree
  20. Print top view of a binary tree using level order traversal
  21. Print bottom view of a binary tree
  22. Print bottom view of a binary tree using level order traversal
  23. Remove the nodes of binary search tree which are outside the given range
  24. Remove all nodes which lie on path having sum less than k
  25. Remove all the half nodes from a given binary tree
  26. Print binary tree in vertical order
  27. Populate right neighbors for all nodes in a binary tree
  28. Lowest Common Ancestor of two nodes in a Binary Search Tree
  29. Iterative Pre-order Traversal of a Binary Tree
  30. In-order Successor of a Node in a Binary Tree
  31. Recover a Binary Search Tree if positions of two nodes are swapped.
  32. Find floor and ceiling of an element from given dataset using binary search tree
  33. Diagonal Sum of a Binary Tree.
  34. Create a balanced Binary Search Tree from a sorted array
  35. Convert a sorted Doubly Linked List to Balanced Binary Search Tree
  36. Convert a binary tree to doubly linked list
  37. Check if a binary tree is balanced or not
  38. Check if a binary tree is a binary search tree
  39. Check if two binary search trees are identical given their array representations | Set 2
  40. Check if two binary search trees are identical given their array representations
  41. Check if a binary tree is sub-tree of another binary tree in time O(n)
  42. Check if a binary tree is sub-tree of another binary tree in space O(1)
  43. Binary Search tree | Insertion and Search
  44. Binary Search tree | Deletion
  45. Check if a given binary tree is symmetric tree or not
  46. Check if the given n-ary tree is symmetric tree or not
  47. Spiral Level Order Traversal of a Binary Tree | Set 1
  48. Spiral Level Order Traversal of a Binary Tree | Set 2
  49. Find maximum element from each sub-array of size 'k'| Set 1
  50. Total number of possible Binary Search Trees with 'n' keys
  51. Find the size of largest BST in a binary tree
  52. Lowest Common Ancestor of 2 nodes in a Binary Tree
  53. Find height of the binary tree from its parent array representation
  54. Convert binary tree to binary search tree
  55. Construct the binary tree from its parent array representation
  56. Construct binary tree from inorder and preorder traversals
  57. Construct binary tree from inorder and postorder traversals
  58. AVL tree | Basics
  59. AVL tree | Insertion
  60. AVL tree | Deletion
  61. Trie Data Structure | Insert and search
  62. Trie Data Structure | Delete
  63. Pattern matching using Trie
  64. Longest Prefix Matching using Trie
  65. Given a sequence of words, group together all anagrams and print them.
  66. Serialize and Deserialize a binary search tree
  67. Serialize and Deserialize a binary search tree using post order traversal