Given an array of size n, the task is to find whether array can represent a BST with n levels. Since levels are n, we construct… Read More
Category Archives: Binary Search Tree
Given a Binary Search Tree that contains positive integer values greater than 0. The task is to check whether the BST contains a dead end… Read More
Given a BST and a sum, find if there is a pair with the given sum. Example: Input: sum = 28, given BST Output: Pair… Read More
Round 1: The first round consisted of two coding questions to be solved in 1 hr – Given a binary tree, print the boundary of… Read More
Given a binary search tree and a key. Check the given key exists in BST or not without recursion. Recommended: Please try your approach on… Read More
We have a binary search tree and a number N. Our task is to find the greatest number in the binary search tree that is… Read More
Given an array and an integer K. We need to find the maximum of every segment of length K which has no duplicates in that… Read More
In this article we will see that how to calculate number of elements which are greater than given value in AVL tree. Examples: Input :… Read More
Prerequisites : Red – Black Trees.A left leaning Red Black Tree or (LLRB), is a variant of red black tree, which is a lot easier… Read More
Given two Binary Search Trees consisting of unique positive elements, we have to check whether the two BSTs contain the same set of elements or… Read More
You are given an array of n integer and an integer K. Find the number of total unordered pairs {i, j} such that absolute value… Read More
Given a Binary Search Tree and two keys in it. Find the distance between two nodes with given two keys. It may be assumed that… Read More
Construct the BST (Binary Search Tree) from its given level order traversal. Examples: Input: arr[] = {7, 4, 12, 3, 6, 8, 1, 5, 10}Output:… Read More
Given two BSTs containing n1 and n2 distinct nodes respectively. Given a value x. The problem is to count all pairs from both the BSTs… Read More
We have given a binary search tree and we want to delete the leaf nodes from the binary search tree. Examples: Input : 20 10… Read More