Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Kadane’s Algorithm for Largest Sum Contiguous Subarray in c++ #14

Merged
merged 1 commit into from
Oct 2, 2019

Conversation

vanshikaarora
Copy link
Contributor

Simple idea of the Kadane’s algorithm is to look for all positive contiguous segments of the array (max_ending_here is used for this). And keep track of maximum sum contiguous segment among all positive segments (max_so_far is used for this). Each time we get a positive sum compare it with max_so_far and update max_so_far if it is greater than max_so_far

@nb2998 nb2998 merged commit bc007a6 into nb2998:master Oct 2, 2019
@vanshikaarora
Copy link
Contributor Author

Thanks for approving the PR @nb2998 :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants