In a binary search algorithm, Which is the worst case scenario:-
1.O(1)
2.O(log n)
3.O(n)
4.O(n/2)
reason
Answers
Answered by
0
Explanation:
The answer is the first one. 1.O(1)
Answered by
0
Answer:
The correct answer is 2. O (log n).
Explanation:
For a binary search algorithm, the worst-case scenario would be when the target or what you are searching for is not in the list or search list.
The algorithm will stop when the worst clause is inserted it will terminate the algorithm. Where there is nothing present on the list and it is empty then the log n clause would be needed.
Hence the worst-case scenario is O log n
#SPJ2
Similar questions