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.
In the video, sir said that the order is logN , however here the answer is linear. What is the correct answer?