0
0
DSA Cprogramming~5 mins

Binary Search as Divide and Conquer in DSA C - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the main idea behind the divide and conquer approach in binary search?
Divide the problem into smaller parts by splitting the array into halves, then conquer by searching in the half where the target might be.
Click to reveal answer
beginner
In binary search, what condition decides which half of the array to search next?
Compare the target value with the middle element; if target is smaller, search left half; if larger, search right half.
Click to reveal answer
beginner
Why must the array be sorted for binary search to work?
Because binary search relies on order to decide which half to search next; without sorting, this decision is not possible.
Click to reveal answer
intermediate
What is the time complexity of binary search and why?
O(log n) because each step halves the search space, quickly reducing the problem size.
Click to reveal answer
intermediate
How does binary search demonstrate the divide and conquer strategy?
It divides the array into two halves and conquers by recursively searching the half that may contain the target until found or empty.
Click to reveal answer
What is the first step in binary search on a sorted array?
AFind the middle element
BSort the array
CSearch the entire array linearly
DSwap elements
If the target is greater than the middle element, which part of the array do we search next?
ARight half
BLeft half
CBoth halves
DNone
What happens if the target equals the middle element in binary search?
ASearch left half
BSearch right half
CReturn the middle element's index
DContinue searching both halves
What is the worst-case time complexity of binary search?
AO(n)
BO(log n)
CO(n log n)
DO(1)
Why can't binary search be used on an unsorted array?
ABecause it needs duplicates
BBecause it requires linear search
CBecause it only works on arrays of size 1
DBecause it relies on sorted order to decide which half to search
Explain how binary search uses the divide and conquer approach to find a target in a sorted array.
Think about how the array is split and how the search space shrinks.
You got /4 concepts.
    Describe why binary search is more efficient than linear search for large sorted arrays.
    Focus on how quickly the search space reduces.
    You got /4 concepts.