C++常用算法函数

1、排序 :std::sort

#include 
#include 
 
std::vector<int> v = {
   4, 2, 5, 3, 1};
std::sort(v.begin(), v.end()); // 将v中的元素按升序排序

2、查找: std::find

#include 
#include 
 
std::vector<int> v = {
   1, 2, 3, 4, 5};
auto it = std::find(v.begin(

你可能感兴趣的:(C++,c++,算法)