Next_permutation

What is the order in which next_permutation arranges the digits? Suppose my array is 1,2,3 …then what is the 1st permutation, then the second,…?

hello @diganta_7777 you are asking about the time complexity of that?

No, like the first o/p was 1 3 2, if was followed by 2 1 3, then it was 2 3 1… how is this done i.e. the ordering is done in increasing order?

@diganta_7777 do you now what next_permutation does?
it gives the number which is next greater to the given number.

so from 132 next greater we can form is 213 and then next greater we can form is 231.
it is like that.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.