1D Maximum Subarray

Given an array AA of length nn, find i,ji, j with 1ijn1\leq i \leq j \leq n maximizing x=ijA[x]\sum^j_{x=i} A[x], that is, find a contiguous subarray of AA of maximum sum

Parameters

  • nn: length of array

Filters

Computational Model

Randomization

Approximation

Algorithms Table

Displaying 6 of 6 algorithms

See more
Bird1989O(n)O(n)O(1)O(1) auxiliary
Kadane's Algorithm1982O(n)O(n)O(1)O(1)
Shamos1978O(nlogn)O(n \log n)O(logn)O(\log n)
Brute Force1977O(n3)O(n^3)O(1)O(1)
Grenander1977O(n2)O(n^2)O(n)O(n)
Faster Brute Force (via x[L:U] = x[L:U-1]+x[U])1977O(n2)O(n^2)O(1)O(1)

Reductions Table

Insuffient Data to display table

Other relevant algorithms

Insuffient Data to display table