Home > Back-end > Why next_permutation () some integer array can not be sorted?
Why next_permutation () some integer array can not be sorted?
Time:10-14
There is only one image sort the array answer? ! ? Why is that?
CodePudding user response:
Usage, you have a good look at the next_permutation function before use must be sorted by ascending order before you can get all, otherwise we are in now based on the sort of continue to arrange Permutations of data of ascending to the descending process, such as 123 132 213 231 312 321 It can be seen from 123 to 321 So the first kind, has lined up in reverse chronological order, so next_permutation won't be able to take the next group to arrange take https://blog.csdn.net/HowardEmily/article/details/68064377