I'm having some trouble argumenting for the runtime of this code. I know the code runs at O(n^2), but I've been told to explain why it does. I figured I need to do some calculations on it but I'm stuck. The algorithm (Pseudo code) I need to figure out is.
count = 0 1
for i = 0 to n-2 n
for j = 1 to n n^2
if A[j]<A[i] 1
count = count + 1 1
I've written what I think is the runtime of each line as well. However, I don't know if this is correct.