Quiz on Algorithms STL ques 2

why is the answer order of n and not log(n)

@manika2903 , that’s because its a list (doubly linked list) and binary search in linked list takes o(n) time as finding mid point of linked list takes n/2 operations
so in worst case when element is not found number of operations will be
n/2+n/4+n/8+n/16… + 0=n
thus time complexity being 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.