OK,

On Thu, Feb 21, 2008 at 8:44 AM, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
>
>  hi,
>
>  can some one help me in writing an algorithm for finding permuttaion


I will assume that you want all permutation :

let's call:
-  S your set of number
-  pos your current position

********** WARNING: Untested code follow:  =)********
PERM(pos, S)
   if pos == len(S):
       print S
   for i = pos to len(S):
       swap(S[pos],S[i])
       PERM(pos+1,S)
       swap(S[pos],S[i])

To find all permutation, just call PERM(0,S).

Hope this help,
Caio Valentim

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to