## Find inorder successor for given key in a BST

Given a BST, find inorder successor of a given key in it. If the given key do not lie in the BST, then return the next greater key (if any) present in the BST. Get great deals at Amazon

Coding made easy

Given a BST, find inorder successor of a given key in it. If the given key do not lie in the BST, then return the next greater key (if any) present in the BST. Get great deals at Amazon

Given a BST and a valid range of keys, remove nodes from BST that have keys outside the valid range.

Given a binary search tree, find a pair with given sum present in it.

Convert a given binary tree to BST (Binary Search Tree) by keeping original structure of the binary tree intact.

Given a binary tree, write an efficient algorithm to print binary tree structure in standard output.

Given a BST, find floor and ceil of a given key in it. If the given key lie in the BST, then both floor and ceil is equal to that key, else ceil is equal to next greater key (if any) in the BST and floor is equal to previous greater key (if any) in …

Given a Binary Search Tree and a positive number K, find K’th smallest and K’th largest element in BST.

Given a BST and two nodes x and y in it, find lowest common ancestor (LCA) of x and y in it.

Given a BST, find in-order predecessor of a given key in it. If the given key do not lie in the BST, then return the previous greater key (if any) present in the BST. An in-order predecessor of a node in BST is the previous node in in-order traversal of it.

Given two arrays which represents set of BST keys, check if they represents same BSTs or not. We are not allowed to build the tree.

Given a Binary Tree, determine if it is a BST or not. This problem has a simple recursive solution. The BST property “every node on the right subtree has to be larger than the current node and every node on the left subtree has to be smaller than the current node” is the key …

Given an unsorted array of integers which represents binary search tree keys, construct a height balanced BST from it.