Recall & Review
beginner
What are the three main cases to consider when deleting a node in a Binary Search Tree (BST)?
1. Node to delete is a leaf (no children).<br>2. Node to delete has one child.<br>3. Node to delete has two children.
Click to reveal answer
intermediate
In BST deletion, how do you handle deleting a node with two children?
Replace the node's value with its inorder successor (smallest value in right subtree) or inorder predecessor (largest value in left subtree), then delete that successor/predecessor node.
Click to reveal answer
intermediate
Why do we use the inorder successor or predecessor when deleting a node with two children in a BST?
Because the inorder successor or predecessor maintains the BST property after replacement, ensuring the tree remains correctly ordered.
Click to reveal answer
beginner
What happens if you delete a leaf node in a BST?
The leaf node is simply removed, and its parent's pointer to it is set to null.
Click to reveal answer
beginner
How do you delete a node with only one child in a BST?
Replace the node with its single child by updating the parent's pointer to point to the child, then delete the node.
Click to reveal answer
Which node do you replace a node with when deleting a node with two children in a BST?
✗ Incorrect
The inorder successor or predecessor maintains the BST property after deletion.
What is the first step when deleting a node in a BST?
✗ Incorrect
You must first find the node to delete before handling its removal.
If a node to delete has no children, what do you do?
✗ Incorrect
A leaf node can be removed directly by updating the parent's pointer.
When deleting a node with one child, what happens to the child?
✗ Incorrect
The single child replaces the deleted node to maintain the BST structure.
Which traversal helps find the inorder successor in a BST?
✗ Incorrect
The inorder successor is the smallest node in the right subtree.
Explain the steps to delete a node with two children in a BST.
Think about maintaining BST order after deletion.
You got /4 concepts.
Describe how deleting a node with one child differs from deleting a leaf node in a BST.
Focus on how the parent's pointer changes.
You got /3 concepts.