using System.Collections; using System.Collections.Generic; using AlgorithmCollection; using AlgorithmCollection.Recursion; using UnityEngine; public class Test_Recursion : MonoBehaviour { void Start() { TestPermutations(); } void TestPermutations() { // 全排列 Debug.Log("====全排列===="); List data = new List { 'a', 'b', 'c' }; int count = 0; foreach (List p in RecursionHelper.Permutations(data)) { count++; string content = ""; p.ForEach((char c) => content += c + " "); Debug.Log(content); } Debug.Assert(count == Algorithms.Factorial(data.Count)); } }