kadane: Function that finds the subarray whithin an array that has...

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
kadane_solution(v)

Arguments

v

an array of length n>0

Details

The time complexity of this function is linear

Value

globalMax

the sum of subarray found by the function

start

the starting index of the subarray in the original array

end

the ending index of the subarray in the original array

Examples

1
kadane_solution(c(0, -5, 7, -5, 15, 10, -8, 9, -5))

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