1.

Consider the following implementation of Kadane s algorithm.What changes should be made to the Kadane s algorithm so that it produces the right output even when all array elements are negative? Change 1 = Line 10: int sum = arr[0], ans = arr[0] Change 2 = Line 13: sum = max_num(arr[idx],sum+arr[idx])

A. Only Change 1 is sufficient
B. Only Change 2 is sufficient
C. Both Change 1 and Change 2 are necessary
D. None of the mentioned
Answer» D. None of the mentioned


Discussion

No Comment Found