Implement the following algorithm using Java
Algorithm-1(X : array[P..Q] of integer) 1 maxSoFar = 0
2 for L = P to Q
3Â Â Â Â Â Â for U = L to Q
4Â Â Â Â Â Â Â Â Â Â Â sum =0
5Â Â Â Â Â Â Â Â Â Â Â for I = L to U
6Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â sum = sum + X[I]
/* sum now contains the sum of X[L..U]Â Â */
7 Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â maxSoFar = max (maxSoFar, sum)
8 return maxSoFar
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here