I wrote two generic class to implement these two algorithms, so you can use these classes to generate permutations and combinations for some use, such as software testing.

Using the Code:

C#实现的排列与组合(Permutation & Combination)算法using System;
C#实现的排列与组合(Permutation & Combination)算法
using System.Collections.Generic;
C#实现的排列与组合(Permutation & Combination)算法
using System.Text;
C#实现的排列与组合(Permutation & Combination)算法
using System.Collections;
C#实现的排列与组合(Permutation & Combination)算法
C#实现的排列与组合(Permutation & Combination)算法
namespace CombinationAlgorithmic


output:
10 Combinations of Array "1,2,3,4,5":

 

1,2,3

1,2,4

1,2,5

1,3,4

1,3,5

1,4,5

2,3,4

2,3,5

2,4,5

3,4,5

24 Permutations of Array "dog,cat,bird,bat":

dog,cat,bird,bat

dog,cat,bat,bird

dog,bird,cat,bat

dog,bat,cat,bird

dog,bird,bat,cat

dog,bat,bird,cat

cat,dog,bird,bat

cat,dog,bat,bird

bird,dog,cat,bat

bat,dog,cat,bird

bird,dog,bat,cat

bat,dog,bird,cat

cat,bird,dog,bat

cat,bat,dog,bird

bird,cat,dog,bat

bat,cat,dog,bird

bird,bat,dog,cat

bat,bird,dog,cat

cat,bird,bat,dog

cat,bat,bird,dog

bird,cat,bat,dog

bat,cat,bird,dog

bird,bat,cat,dog

bat,bird,cat,dog

Download the Source Project:
https://files.cnblogs.com/Dah/PermutationCombination.rar

Note: If you find any bug or have some suggestion, please send E-Mail to me or leave your comments here, thanks!

相关文章:

  • 2022-12-23
  • 2021-08-11
  • 2022-12-23
  • 2022-12-23
  • 2021-12-08
  • 2021-07-05
  • 2021-10-02
猜你喜欢
  • 2022-12-23
  • 2021-05-29
  • 2022-01-26
  • 2021-11-11
  • 2022-12-23
  • 2022-12-23
  • 2022-01-04
相关资源
相似解决方案