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 BST nodes are ordered, we can decide to go left or right at each node to find floor or ceil without checking all nodes, making the search faster than scanning the whole tree.
Click to reveal answer
beginner
In a BST, if the current node's value is equal to the target value, what are the floor and ceil?
Both floor and ceil are the current node's value because it exactly matches the target.
Click to reveal answer
intermediate
If the target value is smaller than the current node's value, which subtree should you explore to find the floor?
You should explore the left subtree because all values in the right subtree are greater than the current node's value, which is already bigger than the 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 target value is greater than the current node's value, where should you look to find the ceil?
✗ Incorrect
Since the target is greater, the ceil must be in the right subtree or the current node if it matches.
When the current node's value equals the target, what is the floor and ceil?
✗ Incorrect
Exact match means floor and ceil are the same as the current node's value.
Which property of BST helps in finding floor and ceil efficiently?
✗ Incorrect
BST property that left child < node < right child allows efficient search.
If the target value is smaller than the current node's value, which subtree is explored to find the ceil?
✗ Incorrect
Since target is smaller, ceil could be the current node or in the left subtree.
Explain how to find the floor of a given value in a BST step-by-step.
Think about how BST ordering guides your search direction.
You got /6 concepts.
Describe the difference between floor and ceil in a BST with examples.
Use simple numbers to illustrate the concept.
You got /5 concepts.