Auric__ brought next idea :
Bruno Campanini wrote:
Auric__ formulated the question :
Bruno Campanini wrote:
Can anybody convert this recursive procedure to a non-recursive one?
[snip]
The procedure is called, in the simplest way, with:
Call Permutation("string-to-permute").
On the one hand, yes, it can be unrolled, using some combination of
control structures.
On the other hand, *why* do you want it to be unrolled?
Why you ask me that?
It's pretty straightforward: What is the purpose of unrolling the recursive
procedure you posted? What are you trying to accomplish?
There is an algorithm:
a = Left(Str1, i - 1) & Right(Str1, xLen - i)
b = Str2 & Mid(Str1, i, 1)
Call Permutation(a, b, Xrow)
which is well known to the net, whose author is unknown to the net.
It's very simple and efficient and I'd like to preserve in a
non-recursive procedure.
But I am not able to make the conversion.
Here's a Google search that'll get you started:
https://www.google.com/search?q=stri...+non-recursive
Really I don't need that.
Bruno