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 Go, what is the base case when recursively searching for floor or ceil in a BST?
The base case is when the current node is nil, meaning we reached a leaf without finding a better candidate.
Click to reveal answer
beginner
If the target value equals a node's value in BST, what is the floor and ceil?
Both floor and ceil are the node's value itself because it exactly matches 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.
If the target value is smaller than all nodes in the BST, what is the floor?
✗ Incorrect
If target is smaller than all nodes, no floor exists because no node is less than or equal to target.
Which direction do you move in BST when searching for floor if current node value is greater than target?
✗ Incorrect
If current node value is greater than target, floor must be in left subtree.
What is the ceil of a value in a BST?
✗ Incorrect
Ceil is the smallest value in BST greater than or equal to the target.
When target equals a node's value, what should floor and ceil functions return?
✗ Incorrect
Exact match means floor and ceil are the node's value.
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 and how their searches differ.
Focus on comparison direction and candidate updates.
You got /5 concepts.