public void FindMaximumSumOfSubArray()
        {
            int expected = 19;
            int actual   = Kadane.FindMaximumSumOfSubArray(array);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 2
0
    public void TestForKadaneAlgo()
    {
        int[] input = { 1, 2, 3, -2, 5 };
        Assert.Equal(9, Kadane.KadaneAlgo(input));

        int[] input2 = { -1, -2, -3, -4 };
        Assert.Equal(-1, Kadane.KadaneAlgo(input2));
    }
 public void FindSubArrayOfMaximumSum()
 {
     int[] expected = new int[] { 1, 3, -2, 3, 4, 7, 2, -9, 6, 3, 1 };
     int[] actual   = Kadane.FindSubArrayOfMaximumSum(array);
     Assert.AreEqual(expected, actual);
 }