why the complexity is in linear time it should be logrithmic since binary search is called
array is divided into two and then checked?
Time complexity of binary search in stl
@sharad1103
List stl behaviour is similar to linked list so to divide list we need to find mid and to find mid we need to traverse half of list .
recurrence relation for this problem will be
T(n) =T(n/2) + O(n) // O(n) to find mid of list
on solving this recurrence relation we get O(n)
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.