首页  编辑  

排列组合

Tags: /C#/算法/   Date Created:

public void CombinationCollocate( List < string > AStrings, string ANumbers, string APath, int ALen)

{

    if (APath . Length >= ALen)

   {

       AStrings . Add(APath);

        return ;

   }

    for ( int i = 0 ; i < ANumbers . Length; i ++ )

   {

        string vNumbers = ANumbers . Remove(i, 1 );

       CombinationCollocate(AStrings, vNumbers, APath + ANumbers . Substring(i, 1 ), ALen);

   }

} /* CombinationCollocate  */