I am working with this problem:
What is the asymptotic running time of the following piece of code?
if (N < 1000)
for (int i = 0; i < N*N*N; i = i+1) A[i] = j;
else if (N < 10000)
for (int i = 0; i < N; i = i+1) A[i] = j;
else
for (int i = 0; i < N*N; i = i+1) A[i] = i;
Where the possible answers are:
- A) linear in N
- B) linearithmic in N
- C) cubic N
- D) quadratic in N
I am unsure how to calculate it, but when I look at the code I think A and B is not the right answer, because of the for-loops multiply with the variable x-times. If possible, could someone also explain what "Asymptotic time" means?