I read the question in Exercise 4.1-4 in Introduction To Algorithms:
Suppose we change the definition of the maximum-subarray problem to allow the result to be an empty subarray, where the sum of the values of an empty subarray is 0. How would you change any of the algorithms that do not allow empty subarrays to permit an empty subarray to be the result?
I cannot get what's an empty sub-array.
I came across the point that a single number can be returned if the array consists of negative elements only.
Please can anyone explain the concept of an empty sub-array? And how can we have an empty sub-array?
Even if a single element is returned it still means that sub-array is not empty. Please clear the doubt.
Edit:
To make it more clear as a question if I take an array of elements:
[-3,-4,-1,-8]
The answer would be -1
or 0
?
Please explain if why it should be 0
and how can we conclude an empty sub-array.
Thank you.