Maximum Subarray: Difference between revisions

From Algorithm Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
Line 12: Line 12:
== Parameters ==  
== Parameters ==  


n: length of array
$n$: length of array


d: dimensionality of array
$d$: dimensionality of array


== Table of Algorithms ==  
== Table of Algorithms ==  
Line 24: Line 24:
|-
|-


| [[Brute Force (1D Maximum Subarray Maximum Subarray Problem)|Brute Force]] || 1977 || $O(n^{3})$ || $O({1})$ auxiliary || Exact || Deterministic ||   
| [[Brute Force (1D Maximum Subarray Maximum Subarray Problem)|Brute Force]] || 1977 || $O(n^{3})$ || $O({1})$ || Exact || Deterministic ||   
|-
|-
| [[Grenander (1D Maximum Subarray Maximum Subarray Problem)|Grenander]] || 1977 || $O(n^{2})$ || $O(n)$ || Exact || Deterministic ||   
| [[Grenander (1D Maximum Subarray Maximum Subarray Problem)|Grenander]] || 1977 || $O(n^{2})$ || $O(n)$ || Exact || Deterministic ||   
|-
|-
| [[Faster Brute Force (via x(L:U) = x(L:U-1)+x(U)) (1D Maximum Subarray Maximum Subarray Problem)|Faster Brute Force (via x(L:U) = x(L:U-1)+x(U))]] || 1977 || $O(n^{2})$ || $O({1})$ auxiliary || Exact || Deterministic || [https://dl.acm.org/doi/pdf/10.1145/358234.381162 Time]
| [[Faster Brute Force (via x(L:U) = x(L:U-1)+x(U)) (1D Maximum Subarray Maximum Subarray Problem)|Faster Brute Force (via x(L:U) = x(L:U-1)+x(U))]] || 1977 || $O(n^{2})$ || $O({1})$ || Exact || Deterministic || [https://dl.acm.org/doi/pdf/10.1145/358234.381162 Time]
|-
|-
| [[Shamos (1D Maximum Subarray Maximum Subarray Problem)|Shamos]] || 1978 || $O(nlogn)$ || $O(log n)$ auxiliary || Exact || Deterministic ||   
| [[Shamos (1D Maximum Subarray Maximum Subarray Problem)|Shamos]] || 1978 || $O(n \log n)$ || $O(\log n)$ || Exact || Deterministic ||   
|-
|-
| [[Kadane's Algorithm (1D Maximum Subarray Maximum Subarray Problem)|Kadane's Algorithm]] || 1982 || $O(n)$ || $O({1})$ auxiliary || Exact || Deterministic ||   
| [[Kadane's Algorithm (1D Maximum Subarray Maximum Subarray Problem)|Kadane's Algorithm]] || 1982 || $O(n)$ || $O({1})$ auxiliary || Exact || Deterministic ||   
|-
|-
| [[Perumalla and Deo (1D Maximum Subarray Maximum Subarray Problem)|Perumalla and Deo]] || 1995 || $O(log n)$ || $O(n)$ auxiliary || Exact || Parallel || [https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.24.1291&rep=rep1&type=pdf Time]
| [[Perumalla and Deo (1D Maximum Subarray Maximum Subarray Problem)|Perumalla and Deo]] || 1995 || $O(\log n)$ || $O(n)$ auxiliary || Exact || Parallel || [https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.24.1291&rep=rep1&type=pdf Time]
|-
|-
| [[Gries (1D Maximum Subarray Maximum Subarray Problem)|Gries]] || 1982 || $O(n)$ || $O({1})$ auxiliary || Exact || Deterministic || [https://www.sciencedirect.com/science/article/pii/0167642383900151?via%3Dihub Time]
| [[Gries (1D Maximum Subarray Maximum Subarray Problem)|Gries]] || 1982 || $O(n)$ || $O({1})$ auxiliary || Exact || Deterministic || [https://www.sciencedirect.com/science/article/pii/0167642383900151?via%3Dihub Time]
Line 40: Line 40:
| [[Bird (1D Maximum Subarray Maximum Subarray Problem)|Bird]] || 1989 || $O(n)$ || $O({1})$ auxiliary || Exact || Deterministic || [https://dl.acm.org/doi/10.1093/comjnl/32.2.122 Time]
| [[Bird (1D Maximum Subarray Maximum Subarray Problem)|Bird]] || 1989 || $O(n)$ || $O({1})$ auxiliary || Exact || Deterministic || [https://dl.acm.org/doi/10.1093/comjnl/32.2.122 Time]
|-
|-
| [[Ferreira, Camargo, Song (1D Maximum Subarray Maximum Subarray Problem)|Ferreira, Camargo, Song]] || 2014 || $O(log n)$ || $O(n)$ auxiliary || Exact || Parallel || [https://ieeexplore.ieee.org/document/6972008 Time]
| [[Ferreira, Camargo, Song (1D Maximum Subarray Maximum Subarray Problem)|Ferreira, Camargo, Song]] || 2014 || $O(\log n)$ || $O(n)$ auxiliary || Exact || Parallel || [https://ieeexplore.ieee.org/document/6972008 Time]
|-
|-
|}
|}

Latest revision as of 08:23, 10 April 2023

Description

Given a $d$-dimensional array $M$ with $n^d$ real-valued entries, find the $d$-dimensional subarray of $M$ which maximizes the sum of the elements it contains.

Related Problems

Subproblem: 1D Maximum Subarray, 2D Maximum Subarray, Maximum Square Subarray

Related: 2D Maximum Subarray, Maximum Square Subarray

Parameters

$n$: length of array

$d$: dimensionality of array

Table of Algorithms

Name Year Time Space Approximation Factor Model Reference
Brute Force 1977 $O(n^{3})$ $O({1})$ Exact Deterministic
Grenander 1977 $O(n^{2})$ $O(n)$ Exact Deterministic
Faster Brute Force (via x(L:U) = x(L:U-1)+x(U)) 1977 $O(n^{2})$ $O({1})$ Exact Deterministic Time
Shamos 1978 $O(n \log n)$ $O(\log n)$ Exact Deterministic
Kadane's Algorithm 1982 $O(n)$ $O({1})$ auxiliary Exact Deterministic
Perumalla and Deo 1995 $O(\log n)$ $O(n)$ auxiliary Exact Parallel Time
Gries 1982 $O(n)$ $O({1})$ auxiliary Exact Deterministic Time
Bird 1989 $O(n)$ $O({1})$ auxiliary Exact Deterministic Time
Ferreira, Camargo, Song 2014 $O(\log n)$ $O(n)$ auxiliary Exact Parallel Time

Reductions TO Problem

Problem Implication Year Citation Reduction
Distance Product if: to-time: $O(n^{3-\epsilon})$ for some $\epsilon > {0}$
then: from-time: $O(n^{3-\epsilon})$
1998 https://dl.acm.org/doi/abs/10.5555/314613.314823 link
Negative Triangle Detection 1998 https://dl.acm.org/doi/abs/10.5555/314613.314823 link

Reductions FROM Problem

Problem Implication Year Citation Reduction
Negative Triangle Detection 2018 https://dl.acm.org/doi/pdf/10.1145/3186893, Theorem 5.4 link
Max-Weight k-Clique if: to-time: $O(n^{d+\lfloor d/{2}\rfloor-\epsilon})$ for $d$-dimensional hypercube arrays
then: from-time: $O(n^{k-\epsilon})$ on $n$ vertex graphs for $k=d+\lfloor d/{2}\rfloor$
2016 https://arxiv.org/pdf/1602.05837.pdf link