I’m not able to understand how its O(N*N)
int a = 0;
for (i = 0; i < N; i++) {
for (j = N; j > i; j--) {
a = a + i + j;
}
}
I’m not able to understand how its O(N*N)
int a = 0;
for (i = 0; i < N; i++) {
for (j = N; j > i; j--) {
a = a + i + j;
}
}
It’s something like O(N * N/2) which is still quadratic and therefore O(N*N)
Hopefully this will help you understand