Vote count:
0
So I've been trying to find big-Oh complexity using the following algorithm:
for (i = 1; i ≤ n;i + +)
for (j = 0; j < n; j = j + i)
print(Array[j]);
I was told that the optimal way would be represent using summations, and I know it can be represented in some form of a series, I really just don't know where to start. I can see that the outside loop iterates n times, but the inside loop is what gets me. I was hoping I could get a push in the right direction here rather than the answer.
asked 1 min ago
Having trouble finding time-complexity of nested for loop
Aucun commentaire:
Enregistrer un commentaire