Question: One approach to calculate (i, j*) is the algorithm specified by Algorithm 2. In it, calls are made to a function evaluate which is specified

One approach to calculate (i, j*) is the algorithm specified by Algorithm 2. In it, calls are made to a function evaluate which is specified by Algorithm 1. Algorithm 1 evaluate(A,i,j) 1: total-0 2: for k- i,... ,j do 3: tototal +Ak 4: return total Algorithm 2 subsequenceWithMaxSum 1(A) 1: n evaluate(A,answer 0,answer 1]) then answer *- (i,j) 7: return answer (a) [1 mark] Using big-O notation, what is the time complexity of the function evaluate in terms of the length of A? Justify your answer from the pseudocode. (b) [1 mark] Using big-O notation, what is the time complexity of the function subsequenceWithMaxSum 1 in terms of the length of A? Justify your answer from the pseudocode
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
