MaxSubArray: Function that finds the subarray which has the largest sum...

Description Usage Arguments Details Value Examples

Description

It takes an array as input and it spills out three values: the value of sum, the start and the end indexes in the original array

Usage

1
max_subarray(A)

Arguments

A

an array of length > 0

Details

The time complexity of this function is linear

Value

maxSum

the sum of subarray found by the function

indx_start

the starting index of the subarray in the original array

indx_end

the ending index of the subarray in the original array

Examples

1
max_subarray(c(2, -1, 3, -5, 10, 8, -8, 0))

maxime970/Algo documentation built on Jan. 26, 2021, 1:31 a.m.