Maximum subarray problem
The task of finding a contiguous subarray with the largest sum in a given array of numbers
In computer science, the maximum sum subarray problem, also known as the maximum segment sum problem, is the task of finding a contiguous subarray with the largest sum, within a given one-dimensional array A[1...n] of numbers. It can be solved in O ( n ) {\displaystyle O(n)} time and O ( 1 ) {\displaystyle O(1)} space.
Nº Q1334332 ★★
Poco común · Historia
Maximum subarray problem
The task of finding a contiguous subarray with the largest sum in a given array of numbers
In computer science, the maximum sum subarray problem, also known as the maximum segment sum problem, is the task of finding a contiguous subarray with the largest sum, within a given one-dimensional array A[1...n] of numbers. It can be solved in O ( n ) {\displaystyle O(n)} time and O ( 1 ) {\displaystyle O(1)} space.
Último precio
—
Precio mínimo
—
Mediana 7 d
—
Ventas 30 d
0
Rango 30 d
—
En circulación
0
Cotización
mediana
mín – máx
ventas
Sin ventas en el periodo
Ver tabla
| Fecha | mediana | Mín | Máx | ventas |
|---|
Historial de ventas
- Última venta
- —
- Media 30 d
- —
- Mínimo 30 d
- —
- Máximo 30 d
- —
- Ventas 7 d
- 0
- Ventas 30 d
- 0
Aún no hay ventas.
Ventas anónimas: sin comprador ni vendedor. Las cifras solo cuentan ventas entre jugadores.
En Wikipedia
Texto en inglés Aún no hay artículo en tu idioma: extracto en inglés.
In computer science, the maximum sum subarray problem, also known as the maximum segment sum problem, is the task of finding a contiguous subarray with the largest sum, within a given one-dimensional array A[1...n] of numbers. It can be solved in O ( n ) {\displaystyle O(n)} time and O ( 1 ) {\displaystyle O(1)} space. Formally, the task is to find indices i {\displaystyle i} and j {\displaystyle j} with 1 ≤ i ≤ j ≤ n {\displaystyle 1\leq i\leq j\leq n} , such that the sum ∑ x = i j A [ x ] {\displaystyle \sum _{x=i}^{j}A[x]} is as large as possible. (Some formulations of the problem also allow the empty subarray to be considered; by convention, the sum of all values of the empty subarray is zero.) Each number in the input array A could be positive, negative, or zero. For example, for the array of values [−2, 1, −3, 4, −1, 2, 1, −5, 4], the contiguous subarray with the largest sum is [4, −1, 2, 1], with sum 6. Some properties of this problem are: If the array contains all non-negative numbers, then the problem is trivial; a maximum subarray is the entire array. If the array contains all non-positive numbers, then a solution is any subarray of size 1 containing the maximal value of the array (or the empty subarray, if it is permitted). Several different sub-arrays may have the same maximum sum. Although this problem can be solved using several different algorithmic techniques, including brute force, divide and conquer, dynamic programming, and reduction to shortest paths, a simple single-pass algorithm known as Kadane's algorithm solves it efficiently.
Texto: Wikipedia en inglés, CC BY-SA 4.0. · Imagen: Snydergd (CC BY-SA 4.0) ·