Recall & Review
beginner
What is the BST balancing problem?
The BST balancing problem is about keeping a binary search tree (BST) balanced so that its height stays small. This helps keep operations like search, insert, and delete fast.
Click to reveal answer
beginner
Why does an unbalanced BST cause problems?
An unbalanced BST can become like a linked list, making operations take longer, up to the number of nodes. This slows down searching and updating data.
Click to reveal answer
intermediate
Name one common method to balance a BST.
One common method is using self-balancing trees like AVL trees or Red-Black trees, which automatically keep the tree balanced after insertions and deletions.
Click to reveal answer
beginner
What does 'height' mean in the context of a BST?
Height is the number of edges on the longest path from the root node down to a leaf node. Lower height means faster operations.
Click to reveal answer
intermediate
How does balancing a BST improve search time?
Balancing keeps the tree's height close to log₂(n), where n is the number of nodes. This means search time stays fast, around log₂(n) steps instead of n.
Click to reveal answer
What happens if a BST becomes unbalanced?
✗ Incorrect
An unbalanced BST can become like a linked list, making operations slower.
Which of these is a self-balancing BST?
✗ Incorrect
AVL trees are self-balancing BSTs that keep the tree height small.
What does balancing a BST mainly aim to reduce?
✗ Incorrect
Balancing aims to reduce the tree height to improve operation speed.
What is the worst-case height of an unbalanced BST with n nodes?
✗ Incorrect
In the worst case, an unbalanced BST can have height equal to n, like a linked list.
Which operation is NOT directly improved by balancing a BST?
✗ Incorrect
Balancing a BST improves search, insert, and delete, but not sorting an unrelated array.
Explain why balancing a BST is important and how it affects performance.
Think about how the shape of the tree changes operation times.
You got /3 concepts.
Describe one method used to keep a BST balanced automatically.
Consider trees that adjust themselves after changes.
You got /3 concepts.