Algorithm asymptotic-complexity
问题 I would like to know what is the minimum and maximum value this procedure can return in the following algorithm using the big-theta notation. The algorithm is: procedure F(𝐴[1..n]) s = 0 for i = 1 to n j = min(max(i,A[i]),n³) s = s + j return s 回答1: EDIT: removed original answer as it was for the wrong question. The analysis hinges on the following line: min(max(i,A[i]),n³) If we figure out the cases for this then we can easily figure the cases for the result. We must answer whether i > A[i]