Content deleted Content added
expand generalizations section |
dyn prog |
||
Line 15:
return max_so_far
</source>
Because of the way this algorithm uses optimal substructures (the maximum subarray ending at each position is calculated in a simpler way from a related but smaller and overlapping subproblem, the maximum subarray ending at the previous position) this algorithm can be viewed as a simple example of [[dynamic programming]].
==Generalizations==
Line 46 ⟶ 48:
[[Category:Optimization algorithms]]
[[Category:Dynamic programming]]
[[Category:Articles with example Python code]]
|