Write pseudocode for the brute-force method of solving the maximum-subarray problem. Your procedure should run in time.

Pseudo-code for `FIND-MAXIMUM-SUBARRAY-BF(A, low, high)`

:

1
2
3
4
5
6
7
8
9
10
11
12

left = low
right = high
sum = -∞
for i = low to high
temp_sum = 0
for j = i to high
temp_sum += A[j]
if temp_sum > sum
sum = temp_sum
left = i
right = j
return (left, right, sum)

If you have any question or suggestion or you have found any error in this solution, please leave a comment below.