int n = 1000;
int cnt = 0;
for (int i = 0; i < n; i++)
cnt++;
Is the above code O(n) or O(1)? Could anyone verify this?
Confused about O(n) and O(1)
int n = 1000;
int cnt = 0;
for (int i = 0; i < n; i++)
cnt++;
Is the above code O(n) or O(1)? Could anyone verify this?