If we need to perform many searches in a sorted array, which of the following approaches will be the most efficient?
None of the above.
Sorting the array once using an efficient sorting algorithm and then performing Binary Search repeatedly.
Sorting the array using Bubble Sort before each search and then performing Linear Search.
Performing Linear Search repeatedly.
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
In what scenario would linear search be more suitable than binary search?
Searching for an element in a small, unsorted array.
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.
What is the primary difference between Binary Search and Interpolation Search?
Binary Search only works on sorted arrays, while Interpolation Search can work on unsorted arrays.
Binary Search always divides the array in half, while Interpolation Search estimates the position of the target element.
Binary Search requires more memory than Interpolation Search.
Binary Search is faster than Interpolation Search in all cases.
What is the base case in a recursive implementation of binary search?
Both option1 and option2
When the search interval becomes empty.
When the middle element equals the target element.
When the target element is found.
In the worst-case scenario, how many comparisons will binary search perform on a sorted array of 16 elements?
8
16
4
32
Which of the following is a key difference between the iterative and recursive approaches to binary search?
Iterative binary search uses a loop, while recursive binary search uses function calls.
Iterative binary search is generally more efficient.
Recursive binary search can only be used on arrays, while iterative binary search can be used on any data structure.
Recursive binary search uses a loop, while iterative binary search uses function calls.
Which of the following best describes the time complexity of binary search in the average case?
O(1)
O(log n)
O(n)
O(n log n)
Which of the following best describes the advantage of binary search over linear search?
Binary search uses less memory.
Binary search can be used on unsorted data.
Binary search has a faster average-case time complexity.
Binary search is easier to implement.
Can binary search be used to efficiently search for a target value in a rotated sorted array?
No, binary search is not applicable to rotated sorted arrays.
Yes, but it requires modifications to handle the rotation.
Yes, binary search can be directly applied.
It depends on the pivot point of the rotated array.