non mutating algorithm Question 9

Last Updated :
Discuss
Comments

Which of the following is TRUE about the binary_search() function in C++ STL?

It can search for an element in an unsorted container.

It has a time complexity of O(n).

It always returns an iterator pointing to the found element.

It requires the container to be sorted before searching.

Share your thoughts in the comments