0
0
DSA Goprogramming~5 mins

Floor and Ceil in BST in DSA Go - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
AThe largest value less than or equal to the target
BThe smallest value greater than or equal to the target
CThe root value of the BST
DThe smallest value in the BST
If the target value is smaller than all nodes in the BST, what is the floor?
AThe smallest node value
BThe root node value
CThe largest node value
DNo floor exists (nil)
Which direction do you move in BST when searching for floor if current node value is greater than target?
AGo right
BStop search
CGo left
DReturn current node
What is the ceil of a value in a BST?
ASmallest value greater than or equal to target
BLargest value less than or equal to target
CRoot node value
DLargest value in BST
When target equals a node's value, what should floor and ceil functions return?
AReturn nil for both
BReturn the node's value for both
CReturn left child value
DReturn right child 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.