DSA question set · 200 questions
Binary Search Tree DSA Practice Questions
Explore 200 DSA questions in Binary Search Tree. Practice with DSAWiser’s code editor and visualizer.
BST fundamentals / small drillsCreate a Single-Node BSTCheck Left Child BST InvariantCheck Right Child BST InvariantDetermine Next Search DirectionInsert Second Node into BSTValidate 3-Node Local BST PropertyFind Minimum in a 3-Node BSTFind Maximum in a 3-Node BSTInorder Traversal of a 3-Node BSTCheck if 3-Node Tree Inorder is Strictly SortedInorder Predecessor of Root in a 3-Node BSTInorder Successor of Root in a 3-Node BSTDetect Duplicate Value Violation at RootTarget Search in a 3-Node BSTSearch Comparison Count in a 3-Node BSTMinimum in a Left-Skewed 2-Node BSTMaximum in a Left-Skewed 2-Node BSTMinimum in a Right-Skewed 2-Node BSTMaximum in a Right-Skewed 2-Node BSTCheck if Root is in Range [Low, High]Minimum in a 3-Node Left ChainMaximum in a 3-Node Right ChainCount Elements Smaller than Root in a 3-Node BSTCount Elements Greater than Root in a 3-Node BSTCheck Invariant along a 3-Node Left ChainCheck Invariant along a 3-Node Right ChainInsert Smaller Node into Left-Skewed 2-Node BSTInsert Larger Node into Right-Skewed 2-Node BSTSubtree Pruning Decision for Range QueryPositive Difference with Left ChildPositive Difference with Right ChildPlacement Decision for New ValueInorder Successor of Left Child in 3-Node BSTInorder Predecessor of Right Child in 3-Node BSTCheck Sibling Ordering in BSTConstruct Balanced 3-Node BST from Sorted TripleValid Root Choice for 3 Distinct NumbersLowest Common Ancestor in a 3-Node BSTDelete Minimum in a 3-Node BSTDelete Maximum in a 3-Node BSTDetect Insertion Duplicate ConflictSuccessor Replacement Deletion in 3-Node BSTPredecessor Replacement Deletion in 3-Node BSTPartition of Real Line by BST RootInorder Array after Inserting into 1-Node BSTFind Minimum in Any 3-Node BST ShapeFind Maximum in Any 3-Node BST ShapeSearch Failure Comparison in 1-Node BSTValidate 3-Node Combination of Valid 1-Node SubtreesCheck if Two 2-Node BSTs are IdenticalBST search / traversalSearch in a Binary Search TreeMinimum Element in BSTMaximum Element in BSTRange Sum of BSTLowest Common Ancestor of a BSTTwo Sum IV - Input is a BSTMinimum Absolute Difference in BSTFind Mode in Binary Search TreeFloor in a Binary Search TreeCeiling in a Binary Search TreeInorder Successor in BSTInorder Predecessor in BSTKth Largest Element in a BSTCheck if Array Represents Inorder Traversal of BSTCount Nodes in BST within RangeSecond Largest Element in BSTClosest Value in a Binary Search TreeSum of Elements Smaller than K in BSTSum of Elements Greater than K in BSTCheck if Two BSTs Contain Identical ElementsInsert into a Binary Search Tree (Leaf Node)Absolute Difference Between BST Minimum and MaximumAll Elements in Two Binary Search TreesSearch Path Length in BSTFind Pair with Target Difference in BSTSmallest Node in Right SubtreeLargest Node in Left SubtreeDistance Between Two Nodes in a BSTPrint BST Keys in Descending OrderCheck if Triplet Can Form a BST PreorderBinary-tree supportCount Single-Child Nodes in a BSTSorted Leaf Values of a BSTPath from Root to Target in BSTSmallest Missing Positive Integer in BSTCheck if Root is Average of Children in BSTStrict Upper Bound in BSTStrict Lower Bound in BSTCount Nodes with Both Children in BSTFind Median of a BSTCheck if BST is SkewedHeight of a Binary Search TreeTotal Node Count in BSTRange Sum of BST LeavesTarget Feasibility Check via BST BoundariesIncreasing Order Search TreeConvert Sorted Array to Balanced BSTValidate Binary Search Tree via Inorder CheckConvert BST to Greater Sum TreeCount Subtrees Fully Contained in Range [Low, High]Check if BST is Height-BalancedBST algorithms / mutationDelete Node in a BSTTrim a Binary Search TreeKth Smallest Element in a BSTBinary Search Tree IteratorValidate BST with Range BoundsConstruct Binary Search Tree from Preorder TraversalBST combinatorics / DPUnique Binary Search Trees (Count)Unique Binary Search Trees II (Generate)Recover Binary Search TreeBalance a Binary Search TreeConvert Sorted List to Binary Search TreeSerialize and Deserialize a Strict BSTInorder Successor in BST II (with Parent Pointers)Verify Preorder Sequence in Binary Search TreeSplit BSTConvert Binary Search Tree to Sorted Doubly Linked ListTwo Sum in Two BSTsClosest Binary Search Tree Value IIConstruct Binary Search Tree from Postorder TraversalInorder Predecessor in BST with Parent PointersVerify Postorder Sequence of Binary Search TreeConvert BST to Min-HeapMinimum Swaps to Convert Binary Tree to BSTCheck if Each Internal Node of BST Has Exactly One Child from PreorderCount Pairs from Two BSTs Whose Sum Equals TargetMerge Two BSTs into a Sorted List with Minimal SpaceInorder Predecessor and Successor for Any Key in BSTOrdered-set applicationsReplace Every Element with the Least Greater Element on Its RightLargest BST Subtree in a Binary TreeCheck if Two Arrays Represent the Same BST Without Building TreesShortest Distance Between Two Nodes in a BSTRank from Stream Using Augmented BSTConstruct BST from Level Order Traversal in O(n) TimeFind if a Triplet with Sum Zero Exists in a BSTMerge Two BSTs into a Single Balanced BSTCount Subtrees with All Values in RangeNumber of Unique BSTs with Target HeightCheck if BST Contains a Dead EndPopulate Inorder Successor Pointers in a BSTTwo Sum in a BST with O(h) Space via Dual IteratorsImplement AVL Rotations on a BST NodeClosest Leaf Node to a Target Key in BSTCheck if Array Represents Level Order Traversal of BSTConvert BST to Smaller Sum TreeInversion Count via Augmented BSTOptimal Binary Search Tree Expected Search CostAdvanced BST implementationsRecover BST with Arbitrary Misplaced NodesConstruct Treap / Cartesian Tree from Sorted Inorder Keys in O(n) TimeBST theory / balancingStatic ordered index / finger searchWeight balance / rebuildingOptimization DPPartition DP / segment maximumWilber's First Alternative Lower Bound on BST Access SequencesFind Median of BST in O(1) Extra SpaceDay-Stout-Warren (DSW) In-Place Tree BalancingConvert BST to Greater Sum Tree in O(1) SpaceK Pairs with Smallest Absolute Difference Between Two BSTsMaximum Sum BST in Binary TreeOrdered-set / interval applicationsCount of Smaller Numbers After Self via Augmented BSTData Stream as Disjoint Intervals Using Balanced BSTSelf-Balancing AVL Tree ImplementationReverse Pairs Using Augmented BSTMy Calendar III (K-Booking via Dynamic BST)Splay Tree ImplementationCount of Range Sum via Augmented Self-Balancing BSTTreap Split and Merge PrimitivesRange Module Using Balanced Interval BSTNumber of Ways to Reorder Array to Get Same BSTPersistent Binary Search Tree with Path CopyingFalling Squares via Dynamic Coordinate Interval BSTRed-Black Tree Insertion with Recoloring and RestructuringImplicit sequence treesImplicit Treap with Range Reversal via Lazy PropagationDynamic Running Median with Arbitrary DeletionsSmallest Range Covering Elements from K Lists via Balanced BSTMerge K BSTs into a Balanced BST with Streaming IteratorsScapegoat Tree with Dynamic Subtree RebuildingRecover BST with Two Swapped Disjoint SubtreesKnuth's Optimal BST in O(n^2) TimePersistent Treap with Pure Functional Split and MergeThe Skyline Problem via Balanced BST Contour TrackingRed-Black Tree Deletion with Double-Black ResolutionInterval Tree for Fast Overlap Queries via Augmented BSTMaximum Subarray Sum in Dynamic Range via Implicit TreapTreap with Range Affine Transformations and Range SumsComputational geometryDynamic Upper Convex Hull Maintenance via Slope-Ordered BSTGeometry / range structures2D range trees / coordinate compressionStrings / sequence treesRope Data Structure via Implicit TreapDynamic/general treesIncremental Minimum Spanning Forest via Link-Cut TreeSuffix BST / exact LCPL1 isotonic regression / slope trickHeavy-Light Tree Decomposition with Path Splay TreesLink-Cut Tree: Dynamic Forest Path Aggregates via Splay TreesKinetic Ordered Tree with Adjacent Crossing EventsPersistent Convex Hull Trick with Slope Trick via Persistent TreapEuler Tour Tree via Implicit Treap for Dynamic Graph ConnectivityTango Tree: O(log log n) Competitive Binary Search TreeStatic range reporting / fractional cascadingTop Tree: Dynamic Forest Path and Subtree MaintenanceOvermars-van Leeuwen Fully Dynamic Convex HullPlanar Point Location with a Persistent Sweep BSTCartesian-tree pattern matchingCartesian Tree Isomorphism and Signature Matching
What’s in this set
The Binary Search Tree collection contains 200 problems: 50 basic, 44 easy, 58 medium, 38 hard, 10 very hard. Choose a question at your current level, or follow the collection’s order below.
Topics in this collection include BST fundamentals / small drills, Create a Single-Node BST, Check Left Child BST Invariant, Check Right Child BST Invariant, Determine Next Search Direction. Each question shows its own topics and difficulty so you can decide where to begin.
Practice with the code visualizer
- Open a question in the editor and read the statement, inputs, and expected output. Predict the result for a small example before writing code.
- Write a solution and run the examples. If a result differs from your prediction, reduce the input until you can follow each step.
- Step through your code in the visualizer. Use a breakpoint to inspect the state at a specific line, then compare it with your reasoning.
Questions in this set
200 totalOpen a question in the editor to read its statement and examples. Sign in to practice.
- Create a Single-Node BSTBST fundamentals / small drills · Create a Single-Node BSTBasic
- Check Left Child BST InvariantBST fundamentals / small drills · Check Left Child BST InvariantBasic
- Check Right Child BST InvariantBST fundamentals / small drills · Check Right Child BST InvariantBasic
- Determine Next Search DirectionBST fundamentals / small drills · Determine Next Search DirectionBasic
- Insert Second Node into BSTBST fundamentals / small drills · Insert Second Node into BSTBasic
- Validate 3-Node Local BST PropertyBST fundamentals / small drills · Validate 3-Node Local BST PropertyBasic
- Find Minimum in a 3-Node BSTBST fundamentals / small drills · Find Minimum in a 3-Node BSTBasic
- Find Maximum in a 3-Node BSTBST fundamentals / small drills · Find Maximum in a 3-Node BSTBasic
- Inorder Traversal of a 3-Node BSTBST fundamentals / small drills · Inorder Traversal of a 3-Node BSTBasic
- Check if 3-Node Tree Inorder is Strictly SortedBST fundamentals / small drills · Check if 3-Node Tree Inorder is Strictly SortedBasic
- Inorder Predecessor of Root in a 3-Node BSTBST fundamentals / small drills · Inorder Predecessor of Root in a 3-Node BSTBasic
- Inorder Successor of Root in a 3-Node BSTBST fundamentals / small drills · Inorder Successor of Root in a 3-Node BSTBasic
- Detect Duplicate Value Violation at RootBST fundamentals / small drills · Detect Duplicate Value Violation at RootBasic
- Target Search in a 3-Node BSTBST fundamentals / small drills · Target Search in a 3-Node BSTBasic
- Search Comparison Count in a 3-Node BSTBST fundamentals / small drills · Search Comparison Count in a 3-Node BSTBasic
- Minimum in a Left-Skewed 2-Node BSTBST fundamentals / small drills · Minimum in a Left-Skewed 2-Node BSTBasic
- Maximum in a Left-Skewed 2-Node BSTBST fundamentals / small drills · Maximum in a Left-Skewed 2-Node BSTBasic
- Minimum in a Right-Skewed 2-Node BSTBST fundamentals / small drills · Minimum in a Right-Skewed 2-Node BSTBasic
- Maximum in a Right-Skewed 2-Node BSTBST fundamentals / small drills · Maximum in a Right-Skewed 2-Node BSTBasic
- Check if Root is in Range [Low, High]BST fundamentals / small drills · Check if Root is in Range [Low, High]Basic
- Minimum in a 3-Node Left ChainBST fundamentals / small drills · Minimum in a 3-Node Left ChainBasic
- Maximum in a 3-Node Right ChainBST fundamentals / small drills · Maximum in a 3-Node Right ChainBasic
- Count Elements Smaller than Root in a 3-Node BSTBST fundamentals / small drills · Count Elements Smaller than Root in a 3-Node BSTBasic
- Count Elements Greater than Root in a 3-Node BSTBST fundamentals / small drills · Count Elements Greater than Root in a 3-Node BSTBasic
- Check Invariant along a 3-Node Left ChainBST fundamentals / small drills · Check Invariant along a 3-Node Left ChainBasic
- Check Invariant along a 3-Node Right ChainBST fundamentals / small drills · Check Invariant along a 3-Node Right ChainBasic
- Insert Smaller Node into Left-Skewed 2-Node BSTBST fundamentals / small drills · Insert Smaller Node into Left-Skewed 2-Node BSTBasic
- Insert Larger Node into Right-Skewed 2-Node BSTBST fundamentals / small drills · Insert Larger Node into Right-Skewed 2-Node BSTBasic
- Subtree Pruning Decision for Range QueryBST fundamentals / small drills · Subtree Pruning Decision for Range QueryBasic
- Positive Difference with Left ChildBST fundamentals / small drills · Positive Difference with Left ChildBasic
- Positive Difference with Right ChildBST fundamentals / small drills · Positive Difference with Right ChildBasic
- Placement Decision for New ValueBST fundamentals / small drills · Placement Decision for New ValueBasic
- Inorder Successor of Left Child in 3-Node BSTBST fundamentals / small drills · Inorder Successor of Left Child in 3-Node BSTBasic
- Inorder Predecessor of Right Child in 3-Node BSTBST fundamentals / small drills · Inorder Predecessor of Right Child in 3-Node BSTBasic
- Check Sibling Ordering in BSTBST fundamentals / small drills · Check Sibling Ordering in BSTBasic
- Construct Balanced 3-Node BST from Sorted TripleBST fundamentals / small drills · Construct Balanced 3-Node BST from Sorted TripleBasic
- Valid Root Choice for 3 Distinct NumbersBST fundamentals / small drills · Valid Root Choice for 3 Distinct NumbersBasic
- Lowest Common Ancestor in a 3-Node BSTBST fundamentals / small drills · Lowest Common Ancestor in a 3-Node BSTBasic
- Delete Minimum in a 3-Node BSTBST fundamentals / small drills · Delete Minimum in a 3-Node BSTBasic
- Delete Maximum in a 3-Node BSTBST fundamentals / small drills · Delete Maximum in a 3-Node BSTBasic
- Detect Insertion Duplicate ConflictBST fundamentals / small drills · Detect Insertion Duplicate ConflictBasic
- Successor Replacement Deletion in 3-Node BSTBST fundamentals / small drills · Successor Replacement Deletion in 3-Node BSTBasic
- Predecessor Replacement Deletion in 3-Node BSTBST fundamentals / small drills · Predecessor Replacement Deletion in 3-Node BSTBasic
- Partition of Real Line by BST RootBST fundamentals / small drills · Partition of Real Line by BST RootBasic
- Inorder Array after Inserting into 1-Node BSTBST fundamentals / small drills · Inorder Array after Inserting into 1-Node BSTBasic
- Find Minimum in Any 3-Node BST ShapeBST fundamentals / small drills · Find Minimum in Any 3-Node BST ShapeBasic
- Find Maximum in Any 3-Node BST ShapeBST fundamentals / small drills · Find Maximum in Any 3-Node BST ShapeBasic
- Search Failure Comparison in 1-Node BSTBST fundamentals / small drills · Search Failure Comparison in 1-Node BSTBasic
- Validate 3-Node Combination of Valid 1-Node SubtreesBST fundamentals / small drills · Validate 3-Node Combination of Valid 1-Node SubtreesBasic
- Check if Two 2-Node BSTs are IdenticalBST fundamentals / small drills · Check if Two 2-Node BSTs are IdenticalBasic
- Search in a Binary Search TreeBST search / traversal · Search in a Binary Search TreeEasy
- Minimum Element in BSTBST search / traversal · Minimum Element in BSTEasy
- Maximum Element in BSTBST search / traversal · Maximum Element in BSTEasy
- Range Sum of BSTBST search / traversal · Range Sum of BSTEasy
- Lowest Common Ancestor of a BSTBST search / traversal · Lowest Common Ancestor of a BSTEasy
- Two Sum IV - Input is a BSTBST search / traversal · Two Sum IV - Input is a BSTEasy
- Minimum Absolute Difference in BSTBST search / traversal · Minimum Absolute Difference in BSTEasy
- Find Mode in Binary Search TreeBST search / traversal · Find Mode in Binary Search TreeEasy
- Floor in a Binary Search TreeBST search / traversal · Floor in a Binary Search TreeEasy
- Ceiling in a Binary Search TreeBST search / traversal · Ceiling in a Binary Search TreeEasy
- Inorder Successor in BSTBST search / traversal · Inorder Successor in BSTEasy
- Inorder Predecessor in BSTBST search / traversal · Inorder Predecessor in BSTEasy
- Kth Largest Element in a BSTBST search / traversal · Kth Largest Element in a BSTEasy
- Check if Array Represents Inorder Traversal of BSTBST search / traversal · Check if Array Represents Inorder Traversal of BSTEasy
- Count Nodes in BST within RangeBST search / traversal · Count Nodes in BST within RangeEasy
- Second Largest Element in BSTBST search / traversal · Second Largest Element in BSTEasy
- Closest Value in a Binary Search TreeBST search / traversal · Closest Value in a Binary Search TreeEasy
- Sum of Elements Smaller than K in BSTBST search / traversal · Sum of Elements Smaller than K in BSTEasy
- Sum of Elements Greater than K in BSTBST search / traversal · Sum of Elements Greater than K in BSTEasy
- Check if Two BSTs Contain Identical ElementsBST search / traversal · Check if Two BSTs Contain Identical ElementsEasy
- Insert into a Binary Search Tree (Leaf Node)BST search / traversal · Insert into a Binary Search Tree (Leaf Node)Easy
- Absolute Difference Between BST Minimum and MaximumBST search / traversal · Absolute Difference Between BST Minimum and MaximumEasy
- All Elements in Two Binary Search TreesBST search / traversal · All Elements in Two Binary Search TreesEasy
- Search Path Length in BSTBST search / traversal · Search Path Length in BSTEasy
- Find Pair with Target Difference in BSTBST search / traversal · Find Pair with Target Difference in BSTEasy
- Smallest Node in Right SubtreeBST search / traversal · Smallest Node in Right SubtreeEasy
- Largest Node in Left SubtreeBST search / traversal · Largest Node in Left SubtreeEasy
- Distance Between Two Nodes in a BSTBST search / traversal · Distance Between Two Nodes in a BSTEasy
- Print BST Keys in Descending OrderBST search / traversal · Print BST Keys in Descending OrderEasy
- Check if Triplet Can Form a BST PreorderBST search / traversal · Check if Triplet Can Form a BST PreorderEasy
- Count Single-Child Nodes in a BSTBinary-tree support · Count Single-Child Nodes in a BSTEasy
- Sorted Leaf Values of a BSTBinary-tree support · Sorted Leaf Values of a BSTEasy
- Path from Root to Target in BSTBST search / traversal · Path from Root to Target in BSTEasy
- Smallest Missing Positive Integer in BSTBST search / traversal · Smallest Missing Positive Integer in BSTEasy
- Check if Root is Average of Children in BSTBinary-tree support · Check if Root is Average of Children in BSTEasy
- Strict Upper Bound in BSTBST search / traversal · Strict Upper Bound in BSTEasy
- Strict Lower Bound in BSTBST search / traversal · Strict Lower Bound in BSTEasy
- Count Nodes with Both Children in BSTBinary-tree support · Count Nodes with Both Children in BSTEasy
- Find Median of a BSTBST search / traversal · Find Median of a BSTEasy
- Check if BST is SkewedBinary-tree support · Check if BST is SkewedEasy
- Height of a Binary Search TreeBinary-tree support · Height of a Binary Search TreeEasy
- Total Node Count in BSTBinary-tree support · Total Node Count in BSTEasy
- Range Sum of BST LeavesBST search / traversal · Range Sum of BST LeavesEasy
- Target Feasibility Check via BST BoundariesBST search / traversal · Target Feasibility Check via BST BoundariesEasy
- Increasing Order Search TreeBST search / traversal · Increasing Order Search TreeMedium
- Convert Sorted Array to Balanced BSTBST search / traversal · Convert Sorted Array to Balanced BSTMedium
- Validate Binary Search Tree via Inorder CheckBST search / traversal · Validate Binary Search Tree via Inorder CheckMedium
- Convert BST to Greater Sum TreeBST search / traversal · Convert BST to Greater Sum TreeMedium
- Count Subtrees Fully Contained in Range [Low, High]BST search / traversal · Count Subtrees Fully Contained in Range [Low, High]Medium
- Check if BST is Height-BalancedBinary-tree support · Check if BST is Height-BalancedMedium
- Delete Node in a BSTBST algorithms / mutation · Delete Node in a BSTMedium
- Trim a Binary Search TreeBST algorithms / mutation · Trim a Binary Search TreeMedium
- Kth Smallest Element in a BSTBST algorithms / mutation · Kth Smallest Element in a BSTMedium
- Binary Search Tree IteratorBST algorithms / mutation · Binary Search Tree IteratorMedium
- Validate BST with Range BoundsBST algorithms / mutation · Validate BST with Range BoundsMedium
- Construct Binary Search Tree from Preorder TraversalBST algorithms / mutation · Construct Binary Search Tree from Preorder TraversalMedium
- Unique Binary Search Trees (Count)BST combinatorics / DP · Unique Binary Search Trees (Count)Medium
- Unique Binary Search Trees II (Generate)BST combinatorics / DP · Unique Binary Search Trees II (Generate)Medium
- Recover Binary Search TreeBST algorithms / mutation · Recover Binary Search TreeMedium
- Balance a Binary Search TreeBST algorithms / mutation · Balance a Binary Search TreeMedium
- Convert Sorted List to Binary Search TreeBST algorithms / mutation · Convert Sorted List to Binary Search TreeMedium
- Serialize and Deserialize a Strict BSTBST algorithms / mutation · Serialize and Deserialize a Strict BSTMedium
- Inorder Successor with Parent-Link ConstructionBST algorithms / mutation · Inorder Successor in BST II (with Parent Pointers)Medium
- Verify Preorder Sequence in Binary Search TreeBST algorithms / mutation · Verify Preorder Sequence in Binary Search TreeMedium
- Split BSTBST algorithms / mutation · Split BSTMedium
- BST to Circular Doubly Linked List RecordsBST algorithms / mutation · Convert Binary Search Tree to Sorted Doubly Linked ListMedium
- Two Sum in Two BSTsBST algorithms / mutation · Two Sum in Two BSTsMedium
- Closest Binary Search Tree Value IIBST algorithms / mutation · Closest Binary Search Tree Value IIMedium
- Construct Binary Search Tree from Postorder TraversalBST algorithms / mutation · Construct Binary Search Tree from Postorder TraversalMedium
- Inorder Predecessor with Parent-Link ConstructionBST algorithms / mutation · Inorder Predecessor in BST with Parent PointersMedium
- Verify Postorder Sequence of Binary Search TreeBST algorithms / mutation · Verify Postorder Sequence of Binary Search TreeMedium
- Convert BST to Min-HeapBST algorithms / mutation · Convert BST to Min-HeapMedium
- Minimum Swaps to Convert Binary Tree to BSTBST algorithms / mutation · Minimum Swaps to Convert Binary Tree to BSTMedium
- Check if Each Internal Node of BST Has Exactly One Child from PreorderBST algorithms / mutation · Check if Each Internal Node of BST Has Exactly One Child from PreorderMedium
- Count Pairs from Two BSTs Whose Sum Equals TargetBST algorithms / mutation · Count Pairs from Two BSTs Whose Sum Equals TargetMedium
- Merge Two BSTs into a Sorted List with Minimal SpaceBST algorithms / mutation · Merge Two BSTs into a Sorted List with Minimal SpaceMedium
- Inorder Predecessor and Successor for Any Key in BSTBST algorithms / mutation · Inorder Predecessor and Successor for Any Key in BSTMedium
- Replace Every Element with the Least Greater Element on Its RightOrdered-set applications · Replace Every Element with the Least Greater Element on Its RightMedium
- Largest BST Subtree in a Binary TreeBST algorithms / mutation · Largest BST Subtree in a Binary TreeMedium
- Check if Two Arrays Represent the Same BST Without Building TreesBST algorithms / mutation · Check if Two Arrays Represent the Same BST Without Building TreesMedium
- Shortest Distance Between Two Nodes in a BSTBST algorithms / mutation · Shortest Distance Between Two Nodes in a BSTMedium
- Rank from Stream Using Augmented BSTOrdered-set applications · Rank from Stream Using Augmented BSTMedium
- Construct BST from Level Order Traversal in O(n) TimeBST algorithms / mutation · Construct BST from Level Order Traversal in O(n) TimeMedium
- Find if a Triplet with Sum Zero Exists in a BSTBST algorithms / mutation · Find if a Triplet with Sum Zero Exists in a BSTMedium
- Merge Two BSTs into a Single Balanced BSTBST algorithms / mutation · Merge Two BSTs into a Single Balanced BSTMedium
- Count Subtrees with All Values in RangeBST algorithms / mutation · Count Subtrees with All Values in RangeMedium
- Number of Unique BSTs with Target HeightBST combinatorics / DP · Number of Unique BSTs with Target HeightMedium
- Check if BST Contains a Dead EndBST algorithms / mutation · Check if BST Contains a Dead EndMedium
- Inorder Successor Link Records in a BSTBST algorithms / mutation · Populate Inorder Successor Pointers in a BSTMedium
- Two Sum in a BST with O(h) Space via Dual IteratorsBST algorithms / mutation · Two Sum in a BST with O(h) Space via Dual IteratorsMedium
- Implement AVL Rotations on a BST NodeBST algorithms / mutation · Implement AVL Rotations on a BST NodeMedium
- Closest Leaf Node to a Target Key in BSTBST algorithms / mutation · Closest Leaf Node to a Target Key in BSTMedium
- Check if Array Represents Level Order Traversal of BSTBST algorithms / mutation · Check if Array Represents Level Order Traversal of BSTMedium
- Convert BST to Smaller Sum TreeBST algorithms / mutation · Convert BST to Smaller Sum TreeMedium
- Inversion Count via Augmented BSTOrdered-set applications · Inversion Count via Augmented BSTMedium
- Optimal Binary Search Tree Expected Search CostBST combinatorics / DP · Optimal Binary Search Tree Expected Search CostMedium
- Recover BST with Arbitrary Misplaced NodesAdvanced BST implementations · Recover BST with Arbitrary Misplaced NodesMedium
- Construct Treap / Cartesian Tree from Sorted Inorder Keys in O(n) TimeAdvanced BST implementations · Construct Treap / Cartesian Tree from Sorted Inorder Keys in O(n) TimeMedium
- Finger Search in a BST with a Static Rank IndexBST theory / balancing · Static ordered index / finger searchMedium
- Maintain a Weight-Balanced BST by RebuildingBST theory / balancing · Weight balance / rebuildingMedium
- Partition DP with Segment Maximum and Quadratic Length CostOptimization DP · Partition DP / segment maximumMedium
- Wilber's First Alternative Lower Bound on BST Access SequencesBST theory / balancing · Wilber's First Alternative Lower Bound on BST Access SequencesMedium
- Find Median of BST in O(1) Extra SpaceBST algorithms / mutation · Find Median of BST in O(1) Extra SpaceHard
- Day-Stout-Warren (DSW) In-Place Tree BalancingBST algorithms / mutation · Day-Stout-Warren (DSW) In-Place Tree BalancingHard
- Convert BST to Greater Sum Tree in O(1) SpaceBST algorithms / mutation · Convert BST to Greater Sum Tree in O(1) SpaceHard
- K Pairs with Smallest Absolute Difference Between Two BSTsOrdered-set applications · K Pairs with Smallest Absolute Difference Between Two BSTsHard
- Maximum Sum BST in Binary TreeAdvanced BST implementations · Maximum Sum BST in Binary TreeHard
- Count of Smaller Numbers After Self via Augmented BSTOrdered-set / interval applications · Count of Smaller Numbers After Self via Augmented BSTHard
- Data Stream as Disjoint Intervals Using Balanced BSTOrdered-set / interval applications · Data Stream as Disjoint Intervals Using Balanced BSTHard
- Self-Balancing AVL Tree ImplementationAdvanced BST implementations · Self-Balancing AVL Tree ImplementationHard
- Reverse Pairs Using Augmented BSTOrdered-set / interval applications · Reverse Pairs Using Augmented BSTHard
- My Calendar III (K-Booking via Dynamic BST)Ordered-set / interval applications · My Calendar III (K-Booking via Dynamic BST)Hard
- Splay Tree ImplementationAdvanced BST implementations · Splay Tree ImplementationHard
- Count of Range Sum via Augmented Self-Balancing BSTOrdered-set / interval applications · Count of Range Sum via Augmented Self-Balancing BSTHard
- Treap Split and Merge PrimitivesAdvanced BST implementations · Treap Split and Merge PrimitivesHard
- Range Module Using Balanced Interval BSTOrdered-set / interval applications · Range Module Using Balanced Interval BSTHard
- Number of Ways to Reorder Array to Get Same BSTBST combinatorics / DP · Number of Ways to Reorder Array to Get Same BSTHard
- Persistent Binary Search Tree with Path CopyingAdvanced BST implementations · Persistent Binary Search Tree with Path CopyingHard
- Falling Squares via Dynamic Coordinate Interval BSTOrdered-set / interval applications · Falling Squares via Dynamic Coordinate Interval BSTHard
- Red-Black Tree Insertion with Recoloring and RestructuringAdvanced BST implementations · Red-Black Tree Insertion with Recoloring and RestructuringHard
- Implicit Treap with Range Reversal via Lazy PropagationImplicit sequence trees · Implicit Treap with Range Reversal via Lazy PropagationHard
- Dynamic Running Median with Arbitrary DeletionsOrdered-set / interval applications · Dynamic Running Median with Arbitrary DeletionsHard
- Smallest Range Covering Elements from K Lists via Balanced BSTOrdered-set / interval applications · Smallest Range Covering Elements from K Lists via Balanced BSTHard
- Merge K BSTs into a Balanced BST with Streaming IteratorsAdvanced BST implementations · Merge K BSTs into a Balanced BST with Streaming IteratorsHard
- Scapegoat Tree with Dynamic Subtree RebuildingAdvanced BST implementations · Scapegoat Tree with Dynamic Subtree RebuildingHard
- Recover BST with Two Swapped Disjoint SubtreesAdvanced BST implementations · Recover BST with Two Swapped Disjoint SubtreesHard
- Knuth's Optimal BST in O(n^2) TimeBST combinatorics / DP · Knuth's Optimal BST in O(n^2) TimeHard
- Persistent Treap with Pure Functional Split and MergeAdvanced BST implementations · Persistent Treap with Pure Functional Split and MergeHard
- The Skyline Problem via Balanced BST Contour TrackingOrdered-set / interval applications · The Skyline Problem via Balanced BST Contour TrackingHard
- Red-Black Tree Deletion with Double-Black ResolutionAdvanced BST implementations · Red-Black Tree Deletion with Double-Black ResolutionHard
- Interval Tree for Fast Overlap Queries via Augmented BSTOrdered-set / interval applications · Interval Tree for Fast Overlap Queries via Augmented BSTHard
- Maximum Subarray Sum in Dynamic Range via Implicit TreapImplicit sequence trees · Maximum Subarray Sum in Dynamic Range via Implicit TreapHard
- Treap with Range Affine Transformations and Range SumsImplicit sequence trees · Treap with Range Affine Transformations and Range SumsHard
- Dynamic Upper Convex Hull Maintenance via Slope-Ordered BSTComputational geometry · Dynamic Upper Convex Hull Maintenance via Slope-Ordered BSTHard
- Dynamic 2D Queries with a Compressed Range TreeGeometry / range structures · 2D range trees / coordinate compressionHard
- Rope Data Structure via Implicit TreapStrings / sequence trees · Rope Data Structure via Implicit TreapHard
- Incremental Minimum Spanning Forest via Link-Cut TreeDynamic/general trees · Incremental Minimum Spanning Forest via Link-Cut TreeHard
- Dynamic Suffix BST with Exact LCP UpdatesStrings / sequence trees · Suffix BST / exact LCPHard
- Minimum L1 Cost for a Nondecreasing SequenceOptimization DP · L1 isotonic regression / slope trickHard
- Heavy-Light Tree Decomposition with Path Splay TreesDynamic/general trees · Heavy-Light Tree Decomposition with Path Splay TreesHard
- Link-Cut Tree: Dynamic Forest Path Aggregates via Splay TreesDynamic/general trees · Link-Cut Tree: Dynamic Forest Path Aggregates via Splay TreesVery hard
- Kinetic Ordered Tree with Adjacent Crossing EventsGeometry / range structures · Kinetic Ordered Tree with Adjacent Crossing EventsVery hard
- Persistent Convex Hull Trick with Slope Trick via Persistent TreapGeometry / range structures · Persistent Convex Hull Trick with Slope Trick via Persistent TreapVery hard
- Euler Tour Tree via Implicit Treap for Dynamic Graph ConnectivityDynamic/general trees · Euler Tour Tree via Implicit Treap for Dynamic Graph ConnectivityVery hard
- Tango Tree: O(log log n) Competitive Binary Search TreeBST theory / balancing · Tango Tree: O(log log n) Competitive Binary Search TreeVery hard
- Static 2D Range Reporting with Fractional CascadingGeometry / range structures · Static range reporting / fractional cascadingVery hard
- Top Tree: Dynamic Forest Path and Subtree MaintenanceDynamic/general trees · Top Tree: Dynamic Forest Path and Subtree MaintenanceVery hard
- Overmars-van Leeuwen Fully Dynamic Convex HullGeometry / range structures · Overmars-van Leeuwen Fully Dynamic Convex HullVery hard
- Planar Point Location with a Persistent Sweep BSTGeometry / range structures · Planar Point Location with a Persistent Sweep BSTVery hard
- Cartesian Tree Isomorphism and Signature MatchingCartesian-tree pattern matching · Cartesian Tree Isomorphism and Signature MatchingVery hard