Binary Search Tree Last Updated : 04 Sep, 2025 Comments Improve Suggest changes Like Article Like Report A Binary Search Tree (BST) is a type of binary tree data structure in which each node contains a unique key and satisfies a specific ordering property:All nodes in the left subtree of a node contain values strictly less than the node’s value. All nodes in the right subtree of a node contain values strictly greater than the node’s value.This structure enables efficient operations for searching, insertion, and deletion of elements, especially when the tree remains balanced. Key Characteristics of a BST:Hierarchical Structure: A BST is composed of nodes, each having up to two children, forming a tree-like hierarchy with a single root node at the top.Ordering Property: For every node in the BST, all values in the left subtree are smaller, and all values in the right subtree are larger than the node’s value. This rule holds recursively for all subtrees.Efficient Operations: In a balanced BST, operations like search, insertion, and deletion can be performed in O(log n) time. In the worst-case (unbalanced), these degrade to O(n). With self-balancing BSTs like AVL and Red Black Trees, we can ensure the worst case as O(Log n).Recursive Nature: Each left or right subtree of a node in a BST is itself a BST, allowing recursive algorithms to naturally process the tree.Practical Applications: BSTs are widely used in database indexing, symbol tables, range queries, and are foundational for advanced structures like AVL trees, Red-Black trees. In problem solving, BSTs are used in problems where we need to maintain sorted stream of data. Introduction to Binary Search:Introduction to BSTApplications of BSTBasic Operations on BST:Insertion in BSTSearching in BSTDeletion in BST Minimum in BSTMaximum in BSTFloor in BSTCeil in BSTInorder Successor in BSTInorder Predecessor in BSTHandling duplicates in BSTEasy Standard Problems on BST:Second largest in BSTSum of k smallest in BSTBST keys in given Range BST to Balanced BSTCheck for BSTBinary Tree to BST Check if array is Inorder of BSTSorted Array to Balanced BSTCheck Same BSTs without constructing BST to Min HeapAdd all greater values in a BSTCheck if two BSTs have same elementsMedium Standard Problems on BST:BST from PreorderSorted Linked List to Balanced BSTTransform a BST to greater sum treeBST to a Tree with sum of all smaller keysConstruct BST from Level Order Check if an array can represent Level Order of BSTMax Sum with No Two Adjacent in BSTLCA in a BSTDistance between two nodes of a BST k-th Smallest in BST Largest BST in a Binary Tree | Set 2Remove all leaves from BST2 sum in BSTMax between two nodes of BSTLargest BST Subtree2 Sum in a Balanced BSTTwo nodes of a BST are swapped, correct itLeaf nodes from Preorder of a BSTHard Standard Problems on BST:Construct all possible BSTs for keys 1 to NIn-place Convert BST into a Min-HeapCheck given array of size n can represent BST of n levels or notMerge two BSTs with limited extra spaceK’th Largest Element in BST when modification to BST is not allowedCheck if given sorted sub-sequence exists in binary search treeMaximum Unique Element in every subarray of size KCount pairs from two BSTs whose sum is equal to a given value xFind if there is a triplet in a Balanced BST that adds to zeroReplace every element with the least greater element on its rightLeaf nodes from Preorder of a Binary Search TreeMinimum Possible value of |ai + aj – k| for given array and k.Special two digit numbers in a Binary Search TreeMerge Two Balanced Binary Search TreesSome Quizzes:‘Quizzes’ on Binary Search Tree‘Quizzes’ on Balanced Binary Search TreesQuick Links :‘Practice Problems’ on Binary Search TreeVideos on Binary Search TreeRecommended:Learn Data Structure and Algorithms | DSA Tutorial Binary Search Tree(Background) Visit Course Binary Search Tree(Background) Binary Search Tree(Introduction) Comment More infoAdvertise with us H harendrakumar123 Follow Improve Article Tags : DSA Explore DSA FundamentalsLogic Building Problems 2 min read Analysis of Algorithms 1 min read Data StructuresArray Data Structure 3 min read String in Data Structure 2 min read Hashing in Data Structure 2 min read Linked List Data Structure 2 min read Stack Data Structure 2 min read Queue Data Structure 2 min read Tree Data Structure 4 min read Graph Data Structure 3 min read Trie Data Structure 15+ min read AlgorithmsSearching Algorithms 2 min read Sorting Algorithms 3 min read Introduction to Recursion 14 min read Greedy Algorithms 3 min read Graph Algorithms 3 min read Dynamic Programming or DP 3 min read Bitwise Algorithms 4 min read AdvancedSegment Tree 2 min read Binary Indexed Tree or Fenwick Tree 15 min read Square Root (Sqrt) Decomposition Algorithm 15+ min read Binary Lifting 15+ min read Geometry 2 min read Interview PreparationInterview Corner 3 min read GfG160 3 min read Practice ProblemGeeksforGeeks Practice - Leading Online Coding Platform 6 min read Problem of The Day - Develop the Habit of Coding 5 min read Like