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.
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 smallest value in the BST, what is the floor and ceil?
Floor does not exist (no value less than or equal), ceil is the smallest value in the BST.
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 equals a node's value in BST, what is the ceil?
✗ Incorrect
When the target equals a node's value, the ceil is that node's value.
Which direction do you move in BST if current node's value is greater than target when finding floor?
✗ Incorrect
If current node's value is greater than target, floor must be in left subtree or not exist.
What is the time complexity to find floor or ceil in a balanced BST?
✗ Incorrect
In a balanced BST, searching floor or ceil takes O(log n) time due to tree height.
If target is smaller than all BST values, what is the floor?
✗ Incorrect
No floor exists if target is smaller than all values in BST.
Explain how to find the floor of a given value in a BST step-by-step.
Think about how BST ordering helps decide direction.
You got /6 concepts.
Describe the difference between floor and ceil in a BST with examples.
Use a simple BST and a target value between nodes.
You got /4 concepts.