how does time complexity O(n) in bsearch inbuilt function
Binary search time complexity
@shampblocks
Can you attach the name of the video or the question from the STL quiz, so I can take a look at it.
Binary search is O(logn), if anywhere it is mentioned that it is O(n) then their must be some kind of mistake on their part.
Binary search and most of its associated algorithms(Upper_bound, lower_bound etc) work in O(Logn)
If this resolves your doubt mark it as resolved.
There is a mistake in the the Question, and the complexity of binary search is Logn
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.
