for (i = 0; i < 2*n; i += 2) { for (j=n; j > i; j--) //some code that yields O(1) } I thought the above would yield n*log(n) but I've seen another source say that it is really is n^2 complexity for big Oh. Please explain to me which it is and how i could approach problems like this in the future.
n*(n+1)/2, which is clearlyO(n^2).