I have algorithm that contains next loops:
for (int i = 0; i < size; ++i) {
for (int j = i + 1; j < size; ++j) {
//Do stuff
}
}
I found that this algorithm has $O(n^2)$ complexity but I can't understand why? I.e. if $N = 4$ then $n^2 = 16$ but my loop has 6 iterations only. Just it's a half of $n^2$ value.
P.S. I understand never how to measure the complexity of the algorithm, I only can understand how to write it in the mathematics.