# Category Archives: Binary Search Tree

## Maximum product of bitonic subsequence of size 3

Given an array arr[] of positive integers of size N, the task is to find the maximum product of bitonic subsequence of size 3. Bitonic… Read More »

## Largest element smaller than current element on left for every element in Array

Given an array arr[] of the positive integers of size N, the task is to find the largest element on the left side of each… Read More »

## Total number of BSTs using array elements

Prerequisite: Total number of possible Binary Search Trees with n keys Given an array arr[] of N integers. The task is to count the number… Read More »

## Duplicates Removal in Array using BST

Given an array arr[] of integers, the task is to remove duplicates from the given array. Examples: Input: arr[] = {1, 2, 3, 2, 5,… Read More »

## Median of sliding window in an array

Given an array of integer arr[] and an integer k, the task is to find the median of each window of size k starting from… Read More »

## Check if a Binary Tree is BST : Simple and Efficient Approach

Given a Binary Tree, the task is to check whether the given binary tree is Binary Search Tree or not. A binary search tree (BST)… Read More »

## Difference between Binary Tree and Binary Search Tree

Binary Tree Data Structure A tree whose elements have at most 2 children is called a binary tree. Since each element in a binary tree… Read More »

## Maximum height of the binary search tree created from the given array

Given an array arr[] of N integers, the task is to make two binary search trees. One while traversing from the left side of the… Read More »

## Find maximum count of duplicate nodes in a Binary Search Tree

Given a Binary Search Tree (BST) with duplicates, find the node (the most frequently occurred element) in the given BST. If the BST contains two… Read More »

## Red-Black Trees | Top-Down Insertion

In Bottom-Up insertion of Red-Black Trees, “simple” Binary Search Tree insertion is used, followed by correction of the RB-Tree Violations on the way back up… Read More »

## Implementing a BST where every node stores the maximum number of nodes in the path till any leaf

Given an array of values. The task is to implement a Binary Search Tree using values of the array where every node stores the maximum… Read More »

## Pre-Order Successor of all nodes in Binary Search Tree

Consider a BST(Binary Search Tree) where duplicates are not allowed. Given a key present in the BST. The task is to find its pre-order successor… Read More »

## Lexicographically Smallest Topological Ordering

Given a directed graph with N vertices and M edges that may contain cycles, the task is to find the lexicographically smallest topological ordering of… Read More »

## Print Binary Search Tree in Min Max Fashion

Given a Binary Search Tree (BST), the task is to print the BST in min-max fashion. What is min-max fashion? A min-max fashion means you… Read More »

## Implementing Backward Iterator in BST

Given a Binary search tree, the task is to implement backward iterator on it with the following functions. curr(): returns the pointer to current element.… Read More »