summaryrefslogtreecommitdiff
path: root/Assets/Test/05_Recursion
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-06-24 19:55:26 +0800
committerchai <chaifix@163.com>2021-06-24 19:55:26 +0800
commitdbcd0c269014100b7d4cc421c5ab518f275cca09 (patch)
tree6564ca8a58b6921d4782bba3feae0ea787f9e1f4 /Assets/Test/05_Recursion
parent2749e059084b99737d79aadd92521023b0f65f56 (diff)
Diffstat (limited to 'Assets/Test/05_Recursion')
-rw-r--r--Assets/Test/05_Recursion/Test_Recursion.cs22
1 files changed, 21 insertions, 1 deletions
diff --git a/Assets/Test/05_Recursion/Test_Recursion.cs b/Assets/Test/05_Recursion/Test_Recursion.cs
index 9399bc3..830d2df 100644
--- a/Assets/Test/05_Recursion/Test_Recursion.cs
+++ b/Assets/Test/05_Recursion/Test_Recursion.cs
@@ -16,7 +16,9 @@ public class Test_Recursion : MonoBehaviour
//TestMergeSort();
//TestQuickSort();
//TestBubbleSort();
- TestSelect();
+ //TestSelect();
+ //TestLCS();
+ TestMaxSum();
}
void TestPermutations()
@@ -154,4 +156,22 @@ public class Test_Recursion : MonoBehaviour
}
}
+ void TestLCS()
+ {
+ List<char> lcs = new List<char>();
+ RecursionHelper.FindLCSP("acbcbcef".ToCharArray(), "abcbced".ToCharArray(), ref lcs);
+ Debug.Log(Algorithms.ListToString(lcs));
+
+ lcs.Clear();
+ RecursionHelper.FindLCSS("acbcbcef".ToCharArray(), "abcbced".ToCharArray(), ref lcs);
+ Debug.Log(Algorithms.ListToString(lcs));
+ }
+
+ void TestMaxSum()
+ {
+ int[] n = new int[] { -2, 11, -4, 13, -5, -2};
+ int max = RecursionHelper.CalMaxSum(n);
+ Debug.Log("最大子段和=" + max);
+ }
+
}