## Find Leftmost and Rightmost node of BST from its given preorder traversal

Given a preorder sequence of the binary search tree of N nodes. The task is to find its leftmost and rightmost node. Examples: Input :… Read More »

## Find all the pairs with given sum in a BST | Set 2

Given a Binary Search Tree and an integer sum, the task is to find all the pairs from the tree whose sum is equal to… Read More »

## Sum of cousin nodes of a given node in a BST

Given a binary search tree and a number N, the task is to find the sum of the cousins of the given node N if… Read More »

## Smallest number in BST which is greater than or equal to N ( Iterative Approach)

Given a Binary Search Tree and a number N, the task is to find the smallest number in the binary search tree that is greater… Read More »

## Sum of K largest elements in BST using O(1) Extra space

Given a BST, the task is to find the sum of all elements greater than or equal to K-th largest element in O(1) space. Examples:… Read More »

## Special two digit numbers in a Binary Search Tree

Given a Binary Search Trees, task is to count the number of nodes which are having special two digit numbers. Prerequisite : Special Two Digit… Read More »

## Data Structures | Binary Search Trees | Question 12

Consider the same code as given in above question. What does the function print() do in general? The function print() receives root of a Binary… Read More »

## Data Structures | Binary Search Trees | Question 12

Consider the following code snippet in C. The function print() receives root of a Binary Search Tree (BST) and a positive integer k as arguments.… Read More »

## Data Structures | Binary Search Trees | Question 10

Which of the following traversals is sufficient to construct BST from given traversals 1) Inorder 2) Preorder 3) Postorder (A) Any one of the given… Read More »

## Data Structures | Binary Search Trees | Question 12

Consider the following Binary Search Tree 10 / \ 5 20 / / \ 4 15 30 / 11 If we randomly search one of… Read More »

## Data Structures | Binary Search Trees | Question 8

The preorder traversal sequence of a binary search tree is 30, 20, 10, 15, 25, 23, 39, 35, 42. Which one of the following is… Read More »

## Data Structures | Binary Search Trees | Question 7

The following numbers are inserted into an empty binary search tree in the given order: 10, 1, 3, 5, 15, 12, 16. What is the… Read More »

## Data Structures | Binary Search Trees | Question 6

Suppose the numbers 7, 5, 1, 8, 3, 6, 0, 9, 4, 2 are inserted in that order into an initially empty binary search tree.… Read More »

## Data Structures | Binary Search Trees | Question 5

Which of the following traversal outputs the data in sorted order in a BST? (A) Preorder (B) Inorder (C) Postorder (D) Level order Answer: (B)… Read More »

## Data Structures | Binary Search Trees | Question 4

How many distinct binary search trees can be created out of 4 distinct keys? (A) 4 (B) 14 (C) 24 (D) 42 Answer: (B) Explanation:… Read More »