public void TestFourierTransformNultiplication() { var arithmatic = new Eugene(); var result = arithmatic.MultiplyTwoLargeNumbers_UsingFastFourierTransform(987, 98); Console.WriteLine(string.Join("", result)); }
public void TestHasSubarrayOfSumPositiveNegativeNoZeros() { int[] arr = new int[] { 2, 1, 1, 4, -1, -2, 3 }; bool result = Eugene.HasContiguousPartnersForGivenSum(arr, 0); Assert.IsTrue(result, "It has a sub-array [-1,-2,3] for sum 0"); arr = new int[] { 2, 1, 1, 4, -1, -2, 3 }; result = Eugene.HasContiguousPartnersForGivenSum(arr, 7); Assert.IsTrue(result, "It has a sub-array [2,1,1,4,-1] for sum 7"); arr = new int[] { 2, 1, 1, 4, -1, -2, 3 }; result = Eugene.HasContiguousPartnersForGivenSum(arr, 9); Assert.IsFalse(result, "It has no sub-array for sum 9"); }
public void TestHasSubarrayOfSumAllPositiveNoZeros() { uint[] arr = new uint[] { 1, 3, 5, 7, 9 }; bool result = Eugene.EfficientSumSubarray(arr, 8); Assert.IsTrue(result, "It has a sub-array [3,5] for sum 8"); arr = new uint[] { 10, 3, 5, 7, 9 }; result = Eugene.EfficientSumSubarray(arr, 8); Assert.IsTrue(result, "It has a sub-array [3,5] for sum 8"); arr = new uint[] { 10, 30, 50, 7, 9 }; result = Eugene.EfficientSumSubarray(arr, 7); Assert.IsTrue(result, "It has a sub-array [7] for sum 7"); arr = new uint[] { 10, 30, 50, 7, 9, 1 }; result = Eugene.EfficientSumSubarray(arr, 17); Assert.IsTrue(result, "It has a sub-array [7,9,1] for sum 17"); arr = new uint[] { 10, 30, 50, 7, 9, 1 }; result = Eugene.EfficientSumSubarray(arr, 8); Assert.IsFalse(result, "It has no sub-array for sum 8"); }
public void TestMinSubsequence() { var sub = Eugene.ShortestSubsequenceInSCoveringT("bdaebcwagtadb", "abc"); Assert.IsTrue(sub == "aebc"); }