Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

Algorithm 1 evaluate(A,i,j) 1: total 0 2: for k = i, . , j do 3: total total +A[k] 4: return total Algorithm 2 subsequenceWithMaxSum_1(A) 1: n Size...

Algorithm 1 evaluate(A,i,j)

1: total ← 0

2: for k = i, . . . , j do

3: total ← total +A[k]

4: return total

Algorithm 2 subsequenceWithMaxSum_1(A)

1: n ← Size of A

2: answer ← (0, 0)

3: for i = 0, . . . , n − 1 do

4: for j = i, . . . , n − 1 do

5: if evaluate(A,i,j) > evaluate(A,answer[0],answer[1]) then

6: answer ← (i, j)

7: return answer

How to calculate the complexity of this pseudocode? This is java btw

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question