private void Calc( int [] left , int [] right )
{
if (left . Length <= 0 )
{
for ( int i = 0 ; i < right . Length; i ++ )
{
if (i > 0 ) Console . Write( "," );
Console . Write(array[i, right[i]]);
}
Console . WriteLine();
}
else
{
for ( int i = 0 ; i < left . Length; i ++ )
{
int [] tempLeft = new int [left . Length - 1 ];
int k = 0 ;
for ( int j = 0 ; j < left . Length; j ++ )
{
if (j != i)
{
tempLeft[k ++ ] = left[j];
}
}
int [] tempRight = new int [right . Length + 1 ];
for ( int j = 0 ; j < right . Length; j ++ )
tempRight[j] = right[j];
tempRight[right . Length] = left[i];
Calc(tempLeft, tempRight);
}
}
}
private void button1_Click( object sender , EventArgs e)
{
Calc( new int [] { 0 , 1 , 2 , 3 }, new int [] { });
}