LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default permutation generator help.


I have come across this permutation generator code. But doesn'
understand it
Can anybody explain how this works?
where x will be the string input and y will be initially ""
Sub GetPermutation(x As String, y As String)
' The source of this algorithm is unknown

Dim i As Integer, j As Integer
j = Len(y)
If j < 2 Then
Cells(CurrentRow, 1) = x & y
CurrentRow = CurrentRow + 1
Else
For i = 1 To j
Call GetPermutation(x + Mid(y, i, 1), Left(y, i - 1)
Right(y, j - i))
Next
End If
End Su

--
chandran
-----------------------------------------------------------------------
chandrans's Profile: http://www.excelforum.com/member.php...fo&userid=1436
View this thread: http://www.excelforum.com/showthread.php?threadid=27734

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
permutation Margie Excel Worksheet Functions 3 April 11th 08 12:03 AM
Permutation Builder Stephen Excel Discussion (Misc queries) 3 February 6th 08 07:38 PM
Permutation in excel Sweden Excel Worksheet Functions 2 September 25th 05 05:05 PM
Permutation in excel Sweden Excel Worksheet Functions 1 September 17th 05 02:16 AM
Permutation in excel Sweden Excel Worksheet Functions 2 September 16th 05 06:49 PM


All times are GMT +1. The time now is 12:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"