for (int i = 0; i < N; i ++) print(i);
for (int i = 0; i < N/2; i ++) print(i);
for (int i = 0; i < N; i ++) for (int j = 0; j < N/2; j++) print(i);
for (int i = 0; i < N; i ++) for (int j = 0; j < i; j++) print(i);
for (int i = 0; i < N; i ++) for (int j = 0; j < 5; j++) print(i);
for (int i = 1; i < N/2; i*=2) print(i);
for (int i = N; i > 1; i/=2) print(i);
for (int i = N; i > N-5; i--) print(i);
If a is N x N (square), what is the complexity of this code?
Do the same for a two-dimensional array a.