Bst

20 articles

dsa3 min read

Delete Node in a BST

Find and delete a node from a BST while maintaining BST properties using in-order successor.

Read →
dsa2 min read

Convert BST to Greater Tree

Replace each node value with the sum of all values greater than or equal to it using reverse in-order traversal.

Read →
dsa2 min read

Trim a Binary Search Tree

Trim a BST so all values lie within [low, high] by recursively pruning out-of-range subtrees.

Read →
dsa2 min read

Recover Binary Search Tree

Find and swap the two misplaced nodes in a BST using in-order traversal to detect the violations.

Read →
dsa2 min read

Maximum Sum BST in Binary Tree

Find the maximum sum of any BST subtree within a binary tree using post-order DFS returning subtree metadata.

Read →
dsa2 min read

Binary Search Tree Iterator

Implement an in-order BST iterator with O(h) space using a stack to simulate recursive in-order traversal.

Read →