Skip to content

Category Archives: Binary Search Tree

Largest BST in a Binary Tree | Set 3 Method 3 (Shorter, Smarter and More Efficient)  In this section, a different O(n) solution is discussed.… Read More
Given a sorted array. Write a function that creates a Balanced Binary Search Tree using array elements. Examples:  Input: arr[] = {1, 2, 3}Output: A… Read More
Given a Singly Linked List which has data members sorted in ascending order. Construct a Balanced Binary Search Tree which has same data members as… Read More
Given two values k1 and k2 where k1 < k2 and a root pointer to a Binary Search Tree. The task is to print all… Read More
Given the root of a binary search tree and K as input, find Kth smallest element in BST. For example, in the following BST, if k… Read More
In Binary Tree, Inorder successor of a node is the next node in Inorder traversal of the Binary Tree. Inorder Successor is NULL for the… Read More
Given an array that stores a complete Binary Search Tree, write a function that efficiently prints the given array in ascending order. For example, given an… Read More
Total number of possible Binary Search Trees with n different keys (countBST(n)) = Catalan number Cn = (2n)! / ((n + 1)! * n!) For… Read More
A binary search tree (BST) is a node-based binary tree data structure that has the following properties.  The left subtree of a node contains only… Read More
Write a function to find the node with minimum value in a Binary Search Tree. Example:  Input:   first example BST Output: 8 Input:   second example… Read More
Given two values n1 and n2 in a Binary Search Tree, find the Lowest Common Ancestor (LCA). You may assume that both values exist in… Read More

Start Your Coding Journey Now!