Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Can anybody convert this recursive procedure to a non-recursive one?
======================================== Sub Permutation(Str1 As String, _ Optional Str2 As String = vbNullString, _ Optional ByRef Xrow As Long = 1) Dim i As Integer, xLen As Integer, a As String, b As String xLen = Len(Str1) If xLen < 2 Then Range("A" & Xrow) = Str2 & Str1 Xrow = Xrow + 1 Else For i = 1 To xLen a = Left(Str1, i - 1) & Right(Str1, xLen - i) b = Str2 & Mid(Str1, i, 1) Call Permutation(a, b, Xrow) Next End If End Sub ======================================== The procedure is called, in the simplest way, with: Call Permutation("string-to-permute"). Bruno |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Recursive Functions...maybe | Excel Worksheet Functions | |||
Is this a recursive problem? | Excel Programming | |||
Recursive Code | Excel Programming | |||
Help with Recursive Call? | Excel Programming |