Lowerbound and upperbound

do lowerbound and upperbound use binarysearch to find the address of elements?if yes,is that the reason they have logn time or if no,why do they have logn time?

Hey @kani001
Yes they use Binary search for that and that’s why long complexity :slight_smile:

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.

should we use upperbound and lowerbound only on sorted elements then?

Yes @kani001
They are meant to be used on sorted arrays only

If your doubt is resolved then please mark it as resolved :slight_smile:

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.