首页 > 技术文章 > next_permutation 函数

ccut-ry 2018-07-30 15:25 原文

 

next_permutation 是一个定义在 <algorithm> 中的一个全排列函数, 用于按顺序生成一个数列的全排列

基本用法 :

int a[] = {1, 2, 3};
    
do{
    cout << a[0] << a[1] << a[2] << endl;
}while(next_permutation(a, a+3));

 

推荐阅读