Recall & Review
beginner
What is the floor of a value in a Binary Search Tree (BST)?
The floor of a value in a BST is the greatest value in the BST that is less than or equal to the given value.
Click to reveal answer
beginner
What is the ceil of a value in a Binary Search Tree (BST)?
The ceil of a value in a BST is the smallest value in the BST that is greater than or equal to the given value.
Click to reveal answer
intermediate
How does the BST property help in finding floor and ceil efficiently?
Because in a BST, left child nodes are smaller and right child nodes are larger, we can decide to move left or right at each step to find floor or ceil without checking all nodes.
Click to reveal answer
beginner
In the BST floor search, if the current node's value is greater than the target, which subtree do we explore next?
We explore the left subtree because all values in the right subtree will be even greater, so they can't be floor if current node is already greater than target.
Click to reveal answer
beginner
In the BST ceil search, if the current node's value is less than the target, which subtree do we explore next?
We explore the right subtree because all values in the left subtree are smaller, so they can't be ceil if current node is already less than target.
Click to reveal answer
What does the floor of a value in a BST represent?
✗ Incorrect
Floor is the greatest value in the BST that is less than or equal to the target value.
If the current node's value is equal to the target, what is the floor and ceil?
✗ Incorrect
If the node's value equals the target, both floor and ceil are that value.
When searching for ceil in BST, if current node's value is less than target, where do we go next?
✗ Incorrect
We move to the right subtree to find a value greater than or equal to the target.
Which of these is true about floor and ceil in BST?
✗ Incorrect
Floor is the greatest value less than or equal to target, ceil is the smallest value greater than or equal to target, so floor ≤ ceil.
If no value in BST is less than or equal to target, what is the floor?
✗ Incorrect
If no value ≤ target exists, floor does not exist (null).
Explain how to find the floor of a given value in a BST step-by-step.
Think about how BST ordering helps decide which subtree to explore.
You got /6 concepts.
Describe the difference between floor and ceil in a BST with examples.
Use simple numbers to illustrate the difference.
You got /5 concepts.