Quiz Algorithms STL

Q2 - the answer should be option D, ie “Output is 1 and time complexity is Logarithmic in size of the list.” because binary search is O(log n)

hey @ktushar98 can you please share the question?.

Hey @ktushar98 binary search has time complexity of logn when we are doing it on an array or data structure with contiguous memory, since list has only sequential access which means slow tranversal, it’ll take O(n) for binary search.
accessing the last element in an array is O(1) but accessing the last element in the list is O(n)