I have read through few posts dealing with time complexity and loops and have a question regarding the time complexity of the following nested for loop, in order to reassure my solution:
for(int i = 0; i < n; i++){
for(int j = n; j > i; j--){
#print something
}}
Now I know that the time complexity of the outer loop is O(n), as the number of iterations are n. I guess the inner loop, however, should only iterate n/2 times, as while i is counting up towards n, j is decreasing towards 0 from n in the same manner. Thus, the inner loop should stop after n/2 iterations. Therefore, I would suggest that the time complexity is O(n*n/2) or simplified O(n^2). Am I right? Thanks in advance.