c++中include<algorithm>是什么

c++中include<algorithm>是什么意思?
谢谢,比如的能在多点吗?

1、algorithm意为"算法",是C++的标准模版库(STL)中最重要的头文件之一,提供了大量基于迭代器的非成员模版函数。简而言之,这是一个功能强大的算法库,可以在这里找到大量通用的算法。

2、例如:

#include<algorithm>里面提了两各种排序,分别为升序,降序。
next_permutation(arr,arr+N);
prev_permutation(arr,arr+N)
下面的例为:
#include<iostream> 
#include<algorithm>
using namespace std;
const int N = 4;
int arr[N] = {1,2,3,4};
int main()
{
do{
for(int i=0; i < N; i++)
printf("%d ",arr[i]);
putchar('\n');
}while(next_permutation(arr,arr+N));//prev_permutation(arr,arr+N) 的话arr里的数据按降序排列
return 0;
}
next_permutation是STL中专门用于排列的函数,运行需要包含头文件
#include <algorithm>
using namespace std
next_permutation(start,end)
注意:函数要求输入的是一个升序排列的序列的头指针和尾指针
如果输入的是一个数组例如:
double a[5]
则:
double *start = &a[0];
double *end = &a[5];

温馨提示:答案为网友推荐,仅供参考
第1个回答  2008-12-30
从英文就知道是算法的意思,他是STL中的算法的头文件。

包括了STL容易的算法

比如很有名的 for_each算法
第2个回答  2008-12-30
包含算法类库
比如排序 还有队列的函数本回答被提问者采纳
第3个回答  2019-04-03
1、algorithm意为"算法",是C++的标准模版库(STL)中最重要的头文件之一,提供了大量基于迭代器的非成员模版函数。简而言之,这是一个功能强大的算法库,可以在这里找到大量通用的算法。
2、例如:
#include
里面提了两各种排序,分别为升序,降序。
next_permutation(arr,arr+N);
prev_permutation(arr,arr+N)
下面的例为:
#include

#include

using namespace std;
const int N = 4;
int arr[N] = {1,2,3,4};
int main()
{
do{
for(int i=0; i < N; i++)
printf("%d ",arr[i]);
putchar('\n');
}while(next_permutation(arr,arr+N));//prev_permutation(arr,arr+N) 的话arr里的数据按降序排列
return 0;
}
next_permutation是STL中专门用于排列的函数,运行需要包含头文件
#include

using namespace std
next_permutation(start,end)
注意:函数要求输入的是一个升序排列的序列的头指针和尾指针
如果输入的是一个数组例如:
double a[5]
则:
double *start = &a[0];
double *end = &a[5];