0
0
DSA Javascriptprogramming~5 mins

Floor and Ceil in BST in DSA Javascript - 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 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?
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 current node's value is equal to the target, what is the floor and ceil?
AFloor and ceil do not exist
BFloor is left child, ceil is right child
CFloor is right child, ceil is left child
DFloor and ceil are both the current node's value
When searching for ceil in BST, if current node's value is less than target, where do we go next?
ALeft subtree
BRight subtree
CStop search
DReturn current node
Which of these is true about floor and ceil in BST?
AFloor and ceil are always equal
BFloor is always greater than ceil
CFloor is always less than ceil or equal
DFloor and ceil do not depend on BST structure
If no value in BST is less than or equal to target, what is the floor?
ANull or no floor exists
BRoot value
CSmallest value in BST
DLargest value 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 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.