how to find a maximum sum subarray when we use Kadane,s Algorithm.
How to find Maximum Sum Subarray?
According to kadane’s algorithm, you will maintain two variables, one as current_sum and other variable as maximum_sum_so_far, initialise current_sum=0 and maximum_sum_so_far=ar[0], and then traverse the array elements and then determine, current_sum=current_sum+ar[i];
After this you will check that if(current_sum<0) current_sum=0;
else you will calculate the maximum of the current_sum and maximum_sum_so_far… The biggest of those values will be your answer…