search algorithm
Commonly used search algorithms can be found in the table below.
Function name |
Algorithm Description |
search |
Searches for the position in an iterator range that matches all elements of another iterator range for the first time |
search_n |
Searches for the position of the first occurrence of several identical elements in the iterator range |
binary_search |
Find the specified value in the ordered sequence by dichotomy, return true if found, otherwise return false |
For the specific use of the search algorithm, please refer to the sample code below.
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
static void PrintVector(vector<int>::const_iterator itBegin, vector<int>::const_iter