What is the primary difference between Binary Search and Interpolation Search?
Binary Search is faster than Interpolation Search in all cases.
Binary Search only works on sorted arrays, while Interpolation Search can work on unsorted arrays.
Binary Search requires more memory than Interpolation Search.
Binary Search always divides the array in half, while Interpolation Search estimates the position of the target element.
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.
Performing Linear Search repeatedly.
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.
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?
Directly use linear search
Sort and then use binary search
What is the key characteristic of an array that makes Binary Search applicable?
The array must be of a fixed size.
The array must be sorted.
The array must be stored in contiguous memory locations.
The array must contain only positive integers.
What happens if the target element is not present in the array during Binary Search?
It returns the index where the element should be inserted.
It returns -1.
It throws an exception.
It enters an infinite loop.
What is the base case in a recursive implementation of binary search?
When the middle element equals the target element.
When the search interval becomes empty.
When the target element is found.
Both option1 and option2
How does Binary Search handle duplicate elements in a sorted array?
It returns the index of the first occurrence of the target element.
It returns the index of the last occurrence of the target element.
It throws an error as Binary Search requires unique elements.
It returns the index of any one occurrence of the target element.
Which of the following best describes the time complexity of binary search in the average case?
O(log n)
O(1)
O(n log n)
O(n)
When searching for a value in a very large sorted array, which algorithm is generally more efficient?
Linear search
Binary search
If you need to perform frequent insertions or deletions in the middle of a dataset, is binary search the most suitable choice?
No
Yes