What is the primary advantage of using binary search over linear search for a sorted array?
Binary search uses less memory.
Binary search can handle duplicate elements more efficiently.
Binary search is easier to implement.
Binary search has a faster time complexity in most cases.
You have a sorted array that has been rotated an unknown number of times. Which algorithm is best suited for finding a specific element in this array?
Linear Search
Interpolation Search
Binary Search
Jump Search
In what scenario would linear search be more suitable than binary search?
Searching for a specific value in a sorted array.
Searching for an element in a small, unsorted array.
Finding the median value in a sorted array.
Finding the smallest element in a rotated sorted array.
When searching for a value in a very large sorted array, which algorithm is generally more efficient?
Binary search
Linear search
If you need to perform frequent insertions or deletions in the middle of a dataset, is binary search the most suitable choice?
Yes
No
What is the base case in a recursive implementation of binary search?
When the search interval becomes empty.
When the target element is found.
When the middle element equals the target element.
Both option1 and option2
What value does binary search return if the target element is not present in the sorted array?
Null
-1
Index where the element should be inserted
It depends on the implementation
Which of the following best describes the advantage of binary search over linear search?
Binary search has a faster average-case time complexity.
Binary search can be used on unsorted data.
What is the space complexity of Binary Search (iterative implementation)?
O(log n)
O(n log n)
O(n)
O(1)
Can binary search be used to efficiently search for a target value in a rotated sorted array?
Yes, binary search can be directly applied.
No, binary search is not applicable to rotated sorted arrays.
Yes, but it requires modifications to handle the rotation.
It depends on the pivot point of the rotated array.