I have a set with elements. I need to generate all the permutations of those elements.
The time complexity of the algorithm that I'm using is O(n!) and it is recursion based. Naturally every recursive algorithm can be converted to non-recursive using an infinite loop and a stack.
Is it possible to generate all the permutations without using either recursion or the stack + loop equivalence ?