##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
BSTs combine binary tree structure with ordering. Left is smaller, right is larger for O(log n) search.
K-th order statistics with deletions. Teaches Fenwick tree or segment tree as BST alternative due to memory constraints.
Binary search in tree form
Track maximum segment length with set/multiset. Dynamic insertion and deletion with ordered queries.
Interval scheduling using ordered set. Efficiently track end times for greedy assignment.
BFS with ordered set for lexicographically smallest path. Priority-based exploration using BST properties.
Distribute elements into two heaps maximizing distinct pairs. Frequency-based ordering decisions.
Count non-intersecting segments using binary search on sorted set. Efficient range queries.
Range query optimization with BST-like structure for efficient lookups and updates.
Segment tree for bracket sequences. BST-like range query structure for bracket matching.
Combine sqrt decomposition with precomputation. BST-like thinking for query optimization.
Count palindromic substrings with ordered structure. DP with BST-style range considerations.
Multi-source BFS with ordered processing. Distance computation using sorted structure.
Petya and Array: count subarrays with sum < t. BIT/segment tree for order statistics.
Check BST property with range bounds. Teaches passing min/max constraints through recursion.
Inorder traversal gives sorted order. Foundation for order statistics in BST.
Find next greater node. Teaches BST property exploitation for O(h) successor finding.
Build height-balanced BST from sorted array. Divide and conquer with middle element as root.
Handle all deletion cases: leaf, one child, two children. Uses inorder successor replacement.
Controlled inorder traversal with O(h) space. Teaches iterative traversal with explicit stack.
Sum nodes in range [low, high]. Prune branches using BST property for efficiency.
Find two swapped nodes using inorder traversal. Detect inversions in sorted sequence.