Q.2 Quiz, d) should be the answer

The Time Complexity of Binary Search is logarithmic. Than why b) is given correct & not d) ?

Hi @namandubey20,
To perform a Binary search based on Divide and Conquer Algorithm, determination of the middle element is important. Binary Search is usually fast and efficient for arrays because accessing the middle index between two given indices is easy and fast(Time Complexity O(1)). But memory allocation for the singly linked list is dynamic and non-contiguous, which makes finding the middle element difficult. we can find middle element of linked list using two pointer method which will take (N/2) operations where N is the length of range ({start,end})
so overall in worst case (i.e element not found)=(N/2+N/4+N/8+N/16…) == N
thus time complexity is O(N)

In case of any doubt feel free to ask :slight_smile:
mark your doubt as resolved if you got the answer

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.