next_permutation函数

来源:互联网 发布:linux用yum安装rpm包 编辑:程序博客网 时间:2024/06/05 13:27

博客来自:http://blog.sina.com.cn/s/blog_9f7ea4390101101u.html

这是一个求一个排序的下一个排列的函数,可以遍历全排列,要包含头文件
下面是以前的笔记 与之完全相反的函数还有prev_permutation

(1) int 类型的next_permutation

int main()
{
int a[3];
a[0]=1;a[1]=2;a[2]=3;
do
{
cout<

include //poj 1256 Anagram

include

include

using namespace std;
int cmp(char a,char b) //’A’<’a’<’B’<’b’<…<’Z’<’z’.
{
if(tolower(a)!=tolower(b))
return tolower(a)

0 0