Unsorted Arrays vs Binary Search
1. What is the recurrence relation for Binary Search?
2. In a linked list, which algorithm can be used to search for an element?
3. Let us consider a sorted array of length . What would be the best time complexity of an algorithm to find a pair of numbers such that the absolute difference between them is equal to , i.e., where ?
4. Binary Search is better than Linear Search for a static sorted array.
5. In an array, what would be the time complexity to find the closest upper bound of a given number, where the upper bound is the smallest element greater than or equal to the given number?
6. Why can Binary Search not be directly applied to an unsorted array?
7. An unsorted array contains elements. You first sort it and then perform one Binary Search operation. Ignoring the cost of the final search, what is the main additional cost introduced by this approach?
8. Consider an unsorted array of elements. What is the worst-case time complexity of searching for a particular element using Linear Search?
9. An array is given as , and the task is to determine whether the value is present. Which approach is directly suitable without first sorting the array?