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

# Category Archives: Binary Search Tree

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

Qualcomm visited for both Full time and Internship profiles for both hardware as well as software profiles. Round 1 1st Round was an online MCQ… 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 of N element. The task is to check if it is Inorder traversal of any Binary Search Tree or not. Print “Yes”… Read More

Given a binary search tree which is also a complete binary tree. The problem is to convert the given BST into a Min Heap with… Read More

Given a Binary Search Tree, find median of it. If no. of nodes are even: then median = ((n/2th node + (n+1)/2th node) /2 If… Read More

Given a Preorder traversal of a Binary Search Tree. The task is to print leaf nodes of the Binary Search Tree from the given preorder.… Read More

A threaded binary tree node looks like following. CPP struct Node { struct Node *left, *right; int info; // True if left pointer points… Read More

Vmware conducted their online exam via hirepro. Round 1 : There were 3 sections quants, Technical questions and OOPs based questions, no section had negative… Read More

Round 1 ( Coding Round + MCQs ): Platform : Hackerearth Maximum 0 flipping subarray Find a tour that visits all stations The test cases… Read More

Given a Binary Tree, write a function that returns the size of the largest subtree which is also a Binary Search Tree (BST). If the… Read More

1st Round : 1)https://www.geeksforgeeks.org/maximum-product-subarray/ 2)https://www.geeksforgeeks.org/sort-an-almost-sorted-array-where-only-two-elements-are-swapped/ 3) Delete all nodes whose value is greater than K 2nd Round (1 hr 30 mins) 1) Clone a Binary… Read More

We have already discuss the Binary Threaded Binary Tree.Insertion in Binary threaded tree is similar to insertion in binary tree but we will have to… Read More

We have discussed simple BST insert. How to insert in a tree where parent pointer needs to be maintained. Parent pointers are helpful to quickly… Read More