I have a doubt regarding the time complexity of the approch .
is it O(root(n)).
Time complexity doubt
Hi. This code is for printing all the permutations of a number. Its time complexity is O(n*n!)
In this approac basically we are swapping first 2 elments moving right by 1 index then again swapping right???
We are doing it to find all the possible permutations. and total permutations of a number of length n is n!.
you can refer this for more clarity.
Hope this clears all ur doubts.
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.