Search code examples
functionvectoradtbinary-search

Can I use binary search as ADT for vectors?


I know an inbuilt function as binary_search() for quickly searching a number from sorted array. I want to ask if same binary_search function is there in STL for vectors.


Solution

  • Yes. binary_search uses template and works with several data structures. See this example