In what scenario would linear search be more suitable than binary search?
Searching for a specific value in a sorted array.
Finding the median value in a sorted array.
Finding the smallest element in a rotated sorted array.
Searching for an element in a small, unsorted array.
Which of the following is a key difference between the iterative and recursive approaches to binary search?
Recursive binary search can only be used on arrays, while iterative binary search can be used on any data structure.
Iterative binary search is generally more efficient.
Iterative binary search uses a loop, while recursive binary search uses function calls.
Recursive binary search uses a loop, while iterative binary search uses function calls.
Which data structure inherently benefits from the efficiency of binary search for searching operations?
Linked List
Hash Table
Queue
Binary Search Tree
What is the time complexity of Binary Search in the worst-case scenario?
O(1)
O(n)
O(log n)
O(n log n)
What is the primary difference between Binary Search and Interpolation Search?
Binary Search always divides the array in half, while Interpolation Search estimates the position of the target element.
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.
What is the base case in a recursive implementation of binary search?
When the search interval becomes empty.
When the middle element equals the target element.
When the target element is found.
Both option1 and option2
What happens if the target element is not present in the array during Binary Search?
It enters an infinite loop.
It returns -1.
It returns the index where the element should be inserted.
It throws an exception.
What is the primary advantage of using binary search over linear search for a sorted array?
Binary search can handle duplicate elements more efficiently.
Binary search is easier to implement.
Binary search has a faster time complexity in most cases.
Binary search uses less memory.
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
Can Binary Search be used on an unsorted array?
It depends on the implementation of Binary Search.
No, the array must be sorted for Binary Search to function properly.
Yes, it will still work correctly.
Yes, but it will have a linear time complexity.