0
0
DSA C++programming~5 mins

BST Search Operation in DSA C++ - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a Binary Search Tree (BST)?
A BST is a tree where each node has at most two children. The left child's value is less than the parent's value, and the right child's value is greater. This helps in fast searching.
Click to reveal answer
beginner
How does the search operation work in a BST?
Start at the root. If the value equals the node's value, stop. If smaller, go left. If larger, go right. Repeat until found or no more nodes.
Click to reveal answer
beginner
Why is BST search faster than searching in a list?
BST search skips half of the tree at each step by choosing left or right child based on comparison, unlike a list which checks each item one by one.
Click to reveal answer
intermediate
What is the time complexity of searching in a balanced BST?
The time complexity is O(log n) because each step halves the search space in a balanced BST.
Click to reveal answer
beginner
What happens if the value is not found in the BST during search?
The search reaches a null child (no node), meaning the value is not in the tree.
Click to reveal answer
In a BST, if the search value is less than the current node's value, where do you go next?
ARoot node
BRight child
CParent node
DLeft child
What is the best case time complexity of searching in a BST?
AO(n)
BO(log n)
CO(1)
DO(n log n)
If a BST is not balanced, what can happen to the search time?
AIt becomes O(n)
BIt becomes O(1)
CIt stays O(log n)
DIt becomes O(n log n)
What is the first step in searching a value in a BST?
ACheck the left child
BCompare with the root node
CCheck the right child
DInsert the value
If the search value is greater than the current node's value, where do you move next?
ARight child
BLeft child
CParent node
DRoot node
Explain the step-by-step process of searching a value in a BST.
Think about how you decide which child to visit next.
You got /5 concepts.
    Describe why BST search is more efficient than searching in an unsorted list.
    Focus on how BST structure helps reduce search steps.
    You got /4 concepts.