码迷,mamicode.com
首页 > 其他好文 > 详细

全排列

时间:2018-08-30 16:45:56      阅读:117      评论:0      收藏:0      [点我收藏+]

标签:col   全排列   length   tle   else   cout   []   ++   class   

 1 void FullPermutation(int array[],intleft,intright)
 2 
 3 {
 4 
 5   if(left== right)
 6 
 7   {
 8 
 9     for(inti= 0;i<length;i++)
10 
11       cout<< array[i]<< " ";
12 
15    }
16 
17     else
18 
19   {
20 
21     for(inti= left;i<= right;i++)
22 
23     {
24 
25       swap(array[i],array[left]);
26 
27       FullPermutation(array,left+ 1,right);
28 
29       swap(array[i],array[left]);
31     }
32 
33   }
34 
35 }

 

全排列

标签:col   全排列   length   tle   else   cout   []   ++   class   

原文地址:https://www.cnblogs.com/wfq9330/p/9560765.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!