HarshCasper / NeoAlgo

Bringing all Data Structures and Algorithms under one Roof ⚡
MIT License
876 stars 1.05k forks source link

Kaden's Algorithm #1604

Closed jyoti-2 closed 3 years ago

jyoti-2 commented 3 years ago

Largest possible sum of a contiguous subarray, within a given one-dimensional array using Kaden's Algorithm.

`# max Sum of contiguous subarray def maxSubArraySum(arr, n): current_max = 0 best_sum = 0

for i in range(n):
    current_max = max(arr[i], current_max + arr[i])
    best_sum = max(best_sum, current_max)
return best_sum

arr = [-2, -3, -4, -6, -9] print(maxSubArraySum(arr, len(arr)))`

Siddhant-K-code commented 3 years ago

i can implement this in C++ under C-Plus-Plus/dp/

shraddhavp commented 3 years ago

assigned @jyoti-2 and @Siddhant-K-code

nayanajain commented 3 years ago

Please assign this issue to me in c++

Sarthak-9 commented 3 years ago

I want to work on this in cpp. Please assign it to me. @shraddhavp @dwoc

shraddhavp commented 3 years ago

sorry @Sarthak-9 and @nayanajain it is already assigned

Siddhant-K-code commented 3 years ago

@shraddhavp pls review #1749