In what scenario would linear search be more suitable than binary search?
Finding the smallest element in a rotated sorted array.
Searching for a specific value in a sorted array.
Finding the median value in a sorted array.
Searching for an element in a small, unsorted array.
Which of the following best describes the advantage of binary search over linear search?
Binary search can be used on unsorted data.
Binary search is easier to implement.
Binary search uses less memory.
Binary search has a faster average-case time complexity.
You need to find the first occurrence of a target value in a sorted array with duplicates. Which algorithm is more efficient?
Binary search
Linear search
What is the time complexity of Binary Search in the best-case scenario?
O(1)
O(n log n)
O(log n)
O(n)
Can Binary Search be used on an unsorted array?
Yes, it will still work correctly.
It depends on the implementation of Binary Search.
No, the array must be sorted for Binary Search to function properly.
Yes, but it will have a linear time complexity.
Can binary search be used to efficiently search for a target value in a rotated sorted array?
Yes, but it requires modifications to handle the rotation.
It depends on the pivot point of the rotated array.
No, binary search is not applicable to rotated sorted arrays.
Yes, binary search can be directly applied.
You have an unsorted array, and you need to find a specific value. Is it more efficient to sort the array and then use binary search, or to directly apply linear search?
Sort and then use binary search
Directly use linear search
What is the base case in a recursive implementation of binary search?
When the middle element equals the target element.
When the target element is found.
Both option1 and option2
When the search interval becomes empty.
What is the key requirement for Binary Search to work correctly?
The array must have an even number of elements.
The array must have unique elements.
The array must be sorted.
The array must be circularly sorted.
In the worst-case scenario, how many comparisons will binary search perform on a sorted array of 16 elements?
8
16
4
32