I have this algorithm (in c
code for convenience):
int algo(int *T, int size)
{
int n = 0;
for (int i = 1; i < size; i++) {
for (int j = i; j < size; j++) {
n += (T[i] * T[j]);
}
}
return n;
}
What is this algorithm's time complexity?
My bet is it is n * log (n)
since we have two imbricated iterations on the size
length one time, and onsize - i
the second time, but I am not sure.
A formal proof of the complexity is welcome!