# Category Archives: Binary Search Tree

## Threaded Binary Search Tree | Deletion

A threaded binary tree node looks like following. We have already discussed Insertion of Threaded Binary Search Tree In deletion, first the key to be… Read More »

## Largest BST in a Binary Tree | Set 2

Given a Binary Tree, write a function that returns the size of the largest subtree which is also a Binary Search Tree (BST). If the… Read More »

## Threaded Binary Tree | Insertion

We have already discuss the Binary Threaded Binary Tree. Insertion in Binary threaded tree is similar to insertion in binary tree but we will have… Read More »

## Binary Search Tree insert with Parent Pointer

We have discussed simple BST insert. How to insert in a tree where parent pointer needs to be maintained. Parent pointers are helpful to quickly… Read More »

## Maximum element between two nodes of BST

Given an array of N elements and two integers A, B which belongs to the given array. Create a Binary Search Tree by inserting element… Read More »

## Sum of k smallest elements in BST

Given Binary Search Tree. The task is to find sum of all elements smaller than and equal to Kth smallest element. Examples: Input : K… Read More »

## Check whether BST contains Dead End or not

Given a Binary search Tree that contains positive integer values greater then 0. The task is to check whether the BST contains a dead end… Read More »

## Find the closest element in Binary Search Tree

Given a binary search tree and a target node K. The task is to find the node with minimum absolute difference with given target value… Read More »

## Find pairs with given sum such that pair elements lie in different BSTs

Given two Binary Search Trees (BST) and a given sum. The task is to find pairs with given sum such that each pair elements must… Read More »

## Check if given sorted sub-sequence exists in binary search tree

Given a binary search tree and a sorted sub-sequence. the task is to check if the given sorted sub-sequence exist in binary search tree or… Read More »

## Replace every element with the least greater element on its right

Given an array of integers, replace every element with the least greater element on its right side in the array. If there are no greater… Read More »

## In-place Convert BST into a Min-Heap

Given a Binary Search Tree, convert it into a Min-Heap containing the same elements in O(n) time. Do this in-place. Input: Binary Search Tree 8… Read More »

## Count inversions in an array | Set 2 (Using Self-Balancing BST)

Inversion Count for an array indicates – how far (or close) the array is from being sorted. If array is already sorted then inversion count… Read More »

## Print Common Nodes in Two Binary Search Trees

Given two Binary Search Trees, find common nodes in them. In other words, find intersection of two BSTs. Example: Recommended: Please solve it on “PRACTICE”… Read More »

## How to implement decrease key or change key in Binary Search Tree?

Given a Binary Search Tree, write a function that takes following three as arguments: 1) Root of tree 2) Old key value 3) New Key… Read More »