You need to find the first occurrence of a target value in a sorted array with duplicates. Which algorithm is more efficient?
Linear search
Binary search
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
Jump Search
Binary Search
Interpolation Search
In binary search, what happens if the target value is less than the middle element of the current search interval?
The search terminates as the target is not found.
The search continues in the right half of the interval.
The middle element is compared with its adjacent elements.
The search continues in the left half of the interval.
If you need to perform frequent insertions or deletions in the middle of a dataset, is binary search the most suitable choice?
Yes
No
In the worst-case scenario, how many comparisons will binary search perform on a sorted array of 16 elements?
16
32
8
4
What is the time complexity of Binary Search in the best-case scenario?
O(n log n)
O(n)
O(1)
O(log n)
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 stored in contiguous memory locations.
The array must be sorted.
The array must contain only positive integers.
If we need to perform many searches in a sorted array, which of the following approaches will be the most efficient?
Sorting the array once using an efficient sorting algorithm and then performing Binary Search repeatedly.
None of the above.
Performing Linear Search repeatedly.
Sorting the array using Bubble Sort before each search and then performing Linear Search.
How do you calculate the middle index in Binary Search to avoid potential overflow?
mid = (left + right) / 2
mid = left + (right - left) / 2
mid = (left + right + 1) / 2
mid = left / 2 + right / 2
Which of the following is a prerequisite for using binary search on a dataset?
The data must contain only numerical values.
The data must be stored in a hash table.
The data must be sorted.
The data must be stored in a linked list.