## What is maximum contiguous subsequence sum?

(i.e., the sum of the contiguous subsequence of s that has the largest value). For an empty sequence, the maximum contiguous subsequence sum is −∞. Example 1.3. For s = 〈1,−5, 2,−1, 3〉, the maximum contiguous subsequence is, 〈2,−1, 3〉.

## What is the space complexity of the dynamic programming algorithm for the maximum contiguous subarray problem?

The time complexity will also be O(n), and space complexity will be O(1).

**What is Kadanes algorithm?**

Kadane’s Algorithm is an iterative dynamic programming algorithm. It calculates the maximum sum subarray ending at a particular position by using the maximum sum subarray ending at the previous position. Define two-variable currSum which stores maximum sum ending here and maxSum which stores maximum sum so far.

**What is contiguous subsequence?**

A contiguous subsequence of a list S is a subsequence made up of consecutive elements of S. If S is {5, 15, -30, 10, -5, 40, 10} then 15, -30, 10 is a contiguous subsequence.

### How do you find the maximum contiguous sum?

The idea is simple, find the maximum sum starting from mid point and ending at some point on left of mid, then find the maximum sum starting from mid + 1 and ending with some point on right of mid + 1. Finally, combine the two and return the maximum among left, right and combination of both.

### What is the sum of its maximum subarray?

You are given a one dimensional array that may contain both positive and negative integers, find the sum of contiguous subarray of numbers which has the largest sum. For example, if the given array is {-2, -5, 6, -2, -3, 1, 5, -6}, then the maximum subarray sum is 7 (see highlighted elements).

**Is Kadanes algorithm DP?**

Kadane’s algorithm is usually implemented using a bottom up DP approach to take advantage of the overlapping subproblems and to only compute each subproblem once, hence turning it to O(n).