Interesting Problems on Binary Trees

Binary Trees

A good set of 25 interesting problems that touch various aspects of Binary Trees. Solving these should definitely increase your confidence on B trees.
  1. Lowest Common Ancestor in a Binary tree
  2. Distance between two nodes in a tree
  3. Reverse level order traversal
  4. Print left/right/top view of binary tree
  5. Check if a binary tree is complete or not
  6. Check if a binary tree is balanced or not
  7. Diameter of a given binary tree
  8. Determine if a given binary tree is sub tree or not
  9. Print common nodes on path from root (or common ancestors)
  10. Inorder successor of a given node in Binary tree/ Successor of all nodes ?
  11. Print root to leaf paths in a binary tree  one per line
  12. Boundary traversal of Binary Tree
  13. Construct Tree from Inorder and Preorder/Postorder
  14. Construct Tree from Inorder and Level order ?
  15. Construct a binary tree from Linked list
  16. Convert a binary tree to Double linked list
  17. Convert a binary tree to its mirror tree / Check if two trees are mirror
  18. Convert a given tree to its sum tree / Check if a given BT is sum tree or not ?
  19. Change a binary tree so that every node stores sum of all nodes in left subtree
  20. Connect nodes at same level / Find next node in same level of BT
  21. Serialize and Deserialize a binary tree
  22. Diagonal sum of a binary tree
  23. Print nodes at K distance from root in binary tree
  24. Iterative Inorder/Preorder/Postorder
  25. Convert ternary expression to a Binary Tree

Binary Search Trees



  1. Insertion In BST
  2. Search a given key in BST
  3. Delete a key in BST
  4. Determine if a given Binary tree is BST or not
  5. Find LCA in BST
  6. Find kth smallest or kth largest in BST
  7. Floor and Ceil in a BST
  8. Convert Binary Tree to BST ?
  9. Convert sorted array to Balanced BST
  10. Cost to construct a BST

Comments

Popular posts from this blog

sde-interview-ramp-up

Installing YUM on OpenSUSE

Youtkit - Java Profiler