I'm confused about the complexity of the following (the operation performed inside the inner loop is in constant time):
for(int i=0; i<n; i++)
for(int j=i; j<n; j++)
is this O(n^2) or O(n)? I figure O(n^2). Any ideas?
also the following makes me curious:
for(int i=0; i<n; i++)
for(j=0; j<i; j++)