## Sum and Product of minimum and maximum element of Binary Search Tree

Given a Binary Search Tree. The task is to find the sum and product of maximum and minimum value of tree. For the above tree,… Read More »

## Optimal sequence for AVL tree insertion (without any rotations)

Given an array of integers, the task is to find the sequence in which these integers should be added to an AVL tree such that… Read More »

## Minimum number of nodes in an AVL Tree with given height

Given the height of an AVL tree ‘h’, the task is to find the minimum number of nodes the tree can have. Examples : Input… Read More »

## Print all even nodes of Binary Search Tree

Given a binary search tree. The task is to print all even nodes of the binary search tree. Examples: Input : 5 / \ 3… Read More »

## Remove BST Keys in a given Range

Given a Binary Search Tree (BST) and a range [min, max], remove all keys which are inside the given range. The modified tree should also… Read More »

## Construct a BST from given postorder traversal using Stack

Given postorder traversal of a binary search tree, construct the BST. For example, 1. If the given traversal is {1, 7, 5, 50, 40, 10},… Read More »

## Insert a node in Binary Search Tree Iteratively

A recursive approach to insert a new node in a BST is already discussed in the post: Binary Search Tree | SET 1. In this… Read More »

## Queries to add, remove and return the difference of maximum and minimum.

Given Q queries. The queries are of three types and are described below: Add the number num to the list. Remove the number num from… Read More »

## Check whether the two Binary Search Trees are Identical or Not

Given the root nodes of the two binary search trees. The task is to print 1 if the two Binary Search Trees are identical else… Read More »

## Check if two given key sequences construct same BSTs

Given two arrays which represent two sequences of keys that are used to create BSTs. Imagine we make a Binary Search Tree (BST) from each… Read More »

## Root to leaf path sum equal to a given number in BST

Given a BST and a number. The task is to check whether the given number is equal to the sum of all the node from… Read More »

## Total sum except adjacent of a given node in BST

Given a BST and a key Node, find the total sum in BST, except those Node which are adjacent to key Node. Examples: Recommended: Please… Read More »

## Number of elements smaller than root using preorder traversal of a BST

Given a preorder traversal of a BST. The task is to find the number of elements less than root. Examples: Input: preorder[] = {3, 2,… Read More »

## Reallocation of elements based on Locality of Reference

Consider a problem where same elements are likely to be searched again and again. Implement search operation efficiently. Examples : Input : arr[] = {12… Read More »

## Subarray whose sum is closest to K

Given an array of positive and negative integers and an integer K. The task is to find the subarray which has its sum closest to… Read More »