Skip to main content

All Questions

Filter by
Sorted by
Tagged with
2 votes
1 answer
2k views

Iterative solution for generating all permutations of a string

I know the runtime for generating all permutations is supposed to be \$O(n!)\$. I'm not sure if the code I wrote for it runs in \$O(n!)\$ though. I'm having trouble analyzing its runtime. The ...
fluffychaos's user avatar
4 votes
1 answer
13k views

Permutations of any given numbers

I have solved one programming problem where we have to find all the permutations of given numbers. For example, \$[1,2,3]\$ have the following permutations: $$[1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,...
chmod766's user avatar
  • 131
6 votes
2 answers
4k views

Permutation of given string

I am reading a book on DSA, and the author explains how to generate the permutation of strings using recursion. I want to know if there are better ways of doing the same, unless this is the best ...
luckysing_noobster's user avatar