I was wondering guys if you could explain me how RECURSION works inside a loop!? I got lost here so please anything we ll be much appreciated.
public void perm(int[] list, int k, int m)
{
int i;
if (k == m)
{
for (i = 0; i <= m; i++)
Console.Write(list[i]);
Console.WriteLine(" ");
}
else
for (i = k; i <= m; i++)
{
swap(ref list[k], ref list[i]);
perm(list, k + 1, m);
swap(ref list[k], ref list[i]);
}
}