## Check if a given sequence represents preorder traversal of a BST

Given a distinct sequence of keys, check if it can represent a preorder traversal of a binary search tree (BST).

## Count subtrees in a BST whose nodes lies within a given range

Given a BST, count subtrees in it whose nodes lies within a given range.   For example, consider below BST. The number of subtrees with nodes in the range [5, 20] are 6.

## Build a Binary Search Tree from a Postorder Sequence

Given a distinct sequence of keys which represents postorder traversal of a binary search tree, construct the tree from the postorder sequence.

## Build a Binary Search Tree from a Preorder Sequence

Given a distinct sequence of keys which represents preorder traversal of a binary search tree (BST), construct the tree from the postorder sequence.

## Update every key in BST to contain sum of all greater keys

Given a binary search tree, modify it such that every key is updated to contain sum of all greater keys present in BST.

## 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.

## Construct a Height-Balanced BST from a Sorted Doubly Linked List

Given a sorted Doubly Linked List, in-place convert it into a height-balanced Binary Search Tree (BST). The difference between the height of the left and right subtree for every node of a height-balanced BST is never greater than 1.

## Remove nodes from BST that have keys outside the valid range

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

## Find a pair with given sum in a BST

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

## Convert a Binary Tree to BST by maintaining its original structure

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

## Replace every element of an array with the least greater element on its right

Write an efficient algorithm to replace every element of a given array with the least greater element on its right or with -1 if there are no greater element.

## Print Binary Tree Structure with its contents in C++

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