In terms of space complexity, how does the iterative binary search compare to the recursive one?
It depends on the size of the input array.
Recursive binary search generally uses less space.
Both have the same space complexity.
Iterative binary search generally uses less space.
In the worst-case scenario, how many comparisons will binary search perform on a sorted array of 16 elements?
16
32
4
8
What value does binary search return if the target element is not present in the sorted array?
Index where the element should be inserted
It depends on the implementation
-1
Null
What is the key characteristic of an array that makes Binary Search applicable?
The array must contain only positive integers.
The array must be of a fixed size.
The array must be stored in contiguous memory locations.
The array must be sorted.
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
When searching for a value in a very large sorted array, which algorithm is generally more efficient?
Linear search
Binary search
What is the key requirement for Binary Search to work correctly?
The array must be circularly sorted.
The array must have unique elements.
The array must have an even number of elements.
What is the space complexity of Binary Search (iterative implementation)?
O(log n)
O(1)
O(n log n)
O(n)
How does Binary Search handle duplicate elements in a sorted array?
It returns the index of the last occurrence of the target element.
It returns the index of any one occurrence of the target element.
It throws an error as Binary Search requires unique elements.
It returns the index of the first occurrence of the target element.
What is the primary advantage of using binary search over linear search for a sorted array?
Binary search is easier to implement.
Binary search can handle duplicate elements more efficiently.
Binary search uses less memory.
Binary search has a faster time complexity in most cases.