Created
July 22, 2017 08:49
-
-
Save nerohoop/19965177c0b429982eec3a7c29b62bde to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Initialize: | |
max_so_far = 0 | |
max_ending_here = 0 | |
Loop for each element of the array | |
(a) max_ending_here = max_ending_here + a[i] | |
(b) if(max_ending_here < 0) | |
max_ending_here = 0 | |
(c) if(max_so_far < max_ending_here) | |
max_so_far = max_ending_here | |
return max_so_far |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment