Quiz,related.question

binary_search() -----> O(logn)
this is right !
then its wromg in my quiz [lease check this out.

hi @anonymouslevone_98393e5729c3116b,
yes its logN send question we dont have quiz questions

Choose the correct output and time complexity for the following code : list< int > myList = { 2, 6, 12, 13, 15, 18, 20}; cout << binary_search(myList.begin(), myList.end(), 20) ; Output is 20 and time complexity is Linear in size of the list. Output is 1 and time complexity is Linear in size of the list. Output is 20 and time complexity is Logarithmic in size of the list. Output is 1 and time complexity is Logarithmic in size of the list.

yes last option its output is 1 and time is logarithmic

Could you please explain how the output is 1??

@drishtisingh1210_9ee91bdad7f4552f 20 is present so 1

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.