Binary Search Tree

‘Recent Articles’

Topic :

Basic :

  1. Binary Search Tree | Set 1 (Search and Insertion)
  2. Binary Search Tree | Set 2 (Delete)
  3. Advantages of BST over Hash Table

Construction and Conversion :

  1. Construct BST from given preorder traversal | Set 1
  2. Construct BST from given preorder traversal | Set 2
  3. Binary Tree to Binary Search Tree Conversion
  4. Convert a BST to a Binary Tree such that sum of all greater keys is added to every key
  5. Sorted Linked List to Balanced BST
  6. Sorted Array to Balanced BST
  7. Transform a BST to greater sum tree
  8. Construct all possible BSTs for keys 1 to N
  9. Convert a BST to a Binary Tree such that sum of all greater keys is added to every key
  10. In-place Convert BST into a Min-Heap
  11. Convert BST to Min Heap
  12. Construct BST from its given level order traversal

Check and Smallest/Largest Element :

  1. A program to check if a binary tree is BST or not
  2. Find k-th smallest element in BST (Order Statistics in BST)
  3. Check if each internal node of a BST has exactly one child
  4. Check for Identical BSTs without building the trees
  5. K’th Largest Element in BST when modification to BST is not allowed
  6. Second largest element in BST
  7. K’th smallest element in BST using O(1) Extra Space
  8. Check if given sorted sub-sequence exists in binary search tree
  9. Check whether BST contains Dead End or not
  10. Check if an array represents Inorder of Binary Search tree or not
  11. Check if two BSTs contain same set of elements
  12. Largest number in BST which is less than or equal to N

Red Black Tree and Threaded Binary Tree :

  1. C Program for Red Black Tree Insertion
  2. Left Leaning Red Black Tree (Insertion)
  3. Threaded Binary Tree
  4. Threaded Binary Tree | Insertion
  5. Threaded Binary Search Tree | Deletion

Misc :

  1. Find the node with minimum value in a Binary Search Tree
  2. Total number of possible Binary Search Trees with n keys
  3. Sorted order printing of a given array that represents a BST
  4. Inorder Successor in Binary Search Tree
  5. Print BST keys in the given range
  6. Find the largest BST subtree in a given Binary Tree | Set 1
  7. Merge Two Balanced Binary Search Trees
  8. Merge two BSTs with limited extra space
  9. Two nodes of a BST are swapped, correct the BST
  10. Floor and Ceil from a BST
  11. Find if there is a triplet in a Balanced BST that adds to zero
  12. Find a pair with given sum in a Balanced BST
  13. Remove BST keys outside the given range
  14. Add all greater values to every node in a given BST
  15. Inorder predecessor and successor for a given key in BST
  16. Given n appointments, find all conflicting appointments
  17. How to handle duplicates in Binary Search Tree?
  18. Data Structure for a single resource reservations
  19. Count BST nodes that lie in a given range
  20. Count BST subtrees that lie in given range
  21. How to implement decrease key or change key in Binary Search Tree?
  22. Print Common Nodes in Two Binary Search Trees
  23. Count inversions in an array | Set 2 (Using Self-Balancing BST)
  24. Replace every element with the least greater element on its right
  25. Find pairs with given sum such that pair elements lie in different BSTs
  26. Find the closest element in Binary Search Tree
  27. Sum of k smallest elements in BST
  28. Maximum element between two nodes of BST
  29. Binary Search Tree insert with Parent Pointer
  30. Largest BST in a Binary Tree | Set 2
  31. Leaf nodes from Preorder of a Binary Search Tree
  32. Find median of BST in O(n) time and O(1) space
  33. Remove all leaf nodes from the binary search tree
  34. Count pairs from two BSTs whose sum is equal to a given value x
  35. Find distance between two nodes of a Binary Search Tree
  36. Minimum Possible value of |ai + aj – k| for given array and k.

Quick Links :

Company Wise Coding Practice    Topic Wise Coding Practice