Class MaxSum

java.lang.Object
topics.divideconquer.MaxSum

public class MaxSum extends Object
DIVIDE AND CONQUER PROBLEM: MAXIMUM SUMMATION OF ALL THE SUBSEQUENCES OF n ELEMENTS
Author:
vicegd
  • Constructor Details

    • MaxSum

      public MaxSum()
  • Method Details

    • maxSum1

      public int maxSum1(int[] v)
      This algorithms is iterative. It is cubic O(n^3)
      Parameters:
      v - Vector to calculate the values
      Returns:
      The maximum sum of the subsequences
    • maxSum2

      public int maxSum2(int[] v)
      This algorithms is iterative. It is quadratic O(n^2)
      Parameters:
      v - Vector to calculate the values
      Returns:
      The maximum sum of the subsequences
    • maxSum3

      public int maxSum3(int[] v)
      This algorithms is recursive. It is DandC by division with a=2,b=2,k=1 - O(nlogn)
      Parameters:
      v - Vector to calculate the values
      Returns:
      The maximum sum of the subsequences