# Introduction to Algorithms

Chapter04 - Home
Exercises: 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - 15 - 16 - 17 - 18 - 19 - 20 - 21 - 22 - 23 - 24 - 25 - 26 - 27 - 28 - 29 - 30 - 31 - 32 - 33 - 34 - 35 - 36 - 37 - 38 - 39 - 40 - 41 - 42 - 43 - 44

Exercise. This is the solution to exercise 4.1.1 in the book.

Solution. Find-Maximum-Subarray is a maximizer, over a range of elements or over a single element. When all elements of $A$ are negative, the maximum is not a range of elements but a single element. Hence, in this case the algorithm returns the maximum value (least negative element) of the array $A$.