It’s using binary search algorithm, how can the time complexity be linear instead of logarithmic?
Time complexity not logarithmic in binary
@Paras-Kaushik-446920412565840,
list< int > myList = { 2, 6, 12, 13, 15, 18, 20};
cout << binary_search(myList.begin(), myList.end(), 20) ;
because its a list (doubly linked list) and binary search in linked list takes o(n) time as finding mid point of linked list takes n/2 operations
so in worst case when element is not found number of operations will be
n/2+n/4+n/8+n/16… + 0=n
thus time complexity being o(n)
In case of any doubt feel free to ask 
mark your doubt as resolved if you got the answer