# String permutation pseudo Code

Can you please give pseudo code  algorithm for this code

``````using System;
using System.Text;

namespace Permutations
{
class Permute
{
private void swap (ref char a,ref char b)
{
if(a==b)return;
a^=b;
b^=a;
a^=b;
}

public void Set_Permutation(char[] list)
{
int arrayLength=list.Length-1;
Permutation_Method(list,0,arrayLength);
}

private void Permutation_Method (char[] list,int k,int m)
{
// k intial index passed
// m size of char array
int i;
if(k == m)  // ---------- What is this Condition ?
{
Console.Write(list);
Console.WriteLine(" ");
}
else
for(i = k; i <= m; i++) //  why i=k ?
{
swap(ref list[k], ref list[i]);  // what does this Swap doing ?

//recursive call
Permutation_Method (list, k+1, m);

swap(ref list[k], ref list[i]);   // what does this Swap doing ?
}
}
}

class Class1
{
static void Main()
{

Permute objPermutation =new Permute();
string str="abc";
char[] mycharArray=str.ToCharArray();
/*calling the permute*/
objPermutation.Set_Permutation(mycharArray);
}
}

}
``````

###### Who is Participating?

Commented:
Is http://www.dreamincode.net/code/snippet4662.htm what you are trying to accomplish?

http://weblogs.sqlteam.com/mladenp/archive/2006/03/19/9350.aspx gives a good explanation of string reversal using recursion.

Cheers,
Chris
0

Commented:
Disregard the code snippet above - I was making a couple of notes - forgot to remove the code from my final post. Some comments in it aren't exactly correct. The links I gave you are good though.

Cheers,
Chris
0

Author Commented:
@tampnic

I am sure you did not understood the code .The code is for  String Permutation.

I am requesting String permutation pseudo code for the which I gave
0

Author Commented:
You did not understood the question.  Very poor answer
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.