admin管理员组文章数量:1530845
2024年3月15日发(作者:)
for (int i = n; i >= m; i--)
{
b[m - 1] = i - 1;
if (m > 1)
{
GetCombination(ref list, t, i - 1, m - 1, b, M);
}
else
{
if (list == null)
{
list = new List
}
T[] temp = new T[M];
for (int j = 0; j < ; j++)
{
temp[j] = t[b[j]];
}
(temp);
}
}
}
///
/// 递归算法求排列(私有成员)
///
/// 返回的列表
/// 所求数组
/// 起始标号
/// 结束标号
private static void GetPermutation(ref List
{
if (startIndex == endIndex)
{
if (list == null)
{
list = new List
}
T[] temp = new T[];
(temp, 0);
(temp);
}
else
{
for (int i = startIndex; i <= endIndex; i++)
{
Swap(ref t[startIndex], ref t[i]);
GetPermutation(ref list, t, startIndex + 1, endIndex);
Swap(ref t[startIndex], ref t[i]);
}
}
}
///
/// 求从起始标号到结束标号的排列,其余元素不变
///
/// 所求数组
/// 起始标号
/// 结束标号
///
public static List
{
if (startIndex < 0 || endIndex > - 1)
{
return null;
}
List
GetPermutation(ref list, t, startIndex, endIndex);
return list;
}
///
/// 返回数组所有元素的全排列
///
/// 所求数组
///
public static List
{
return GetPermutation(t, 0, - 1);
}
///
/// 求数组中n个元素的排列
///
/// 所求数组
/// 元素个数
///
public static List
版权声明:本文标题:其它以字典的方式暴力破解压缩文件密码 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/xitong/1710448554a266165.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论