Q2. Algorithms STL#2
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.
I think the answer should be the last option but the answer displayed is the second option