What is the time complexity of searching for an element in an unsorted array?
Answers
Answered by
0
The complexity is O(logn). Binary Search does not work for "un-Sorted" lists. For these lists just do a straight search starting from the first element; this gives a complexity of O(n). If you were to sort the array with MergeSort or any other O(nlogn) algorithm then the complexity would be O(nlogn).
Similar questions