In Binary Search , which will be the scenario for Average Case performance ?
The ‘First key’ is present, but it’s not the middle element O(logn).
The 'Mid key’ is present, but it’s not the middle element O(logn).
The ‘input key’ is present, but it’s not the middle element O(logn).
The ‘Last key’ is present, but it’s not the middle element O(logn).
Answers
Answered by
1
In binary search, there is array containing multiple set of numbers. This numbers are sorted in ascending or descending order. The algorithm states that when any numbered is provided for searching it in the array, then the array is divided into two half.
After the the array is divided then it continues it's same algorithm to finally decide that whether the number is there or not.
In this search the average case scenario is when the ‘First key’ is present, but it’s not the middle element O(logn).
Similar questions