Consider the following C function in which size is the number of elements in the array E:
The value returned by the function MyX is the
(A) maximum possible sum of elements in any sub-array of array E.
(B) maximum element in any sub-array of array E.
(C) sum of the maximum elements in all possible sub-arrays of array E
(D) the sum of all the elements in the array E.
Explanation: Explanation: The function does following
Y is used to store maximum sum seen so far and Z is used to store current sum
1) Initialize Y as sum of all elements
2) For every element, calculate sum of all subarrays starting with arr[i]. Store the current sum in Z. If Z is greater than Y, then update Y.
Quiz of this Question