Confused about O(n) and O(1)

Revision en1, by Destopia, 2020-03-12 01:36:42
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?

Tags #running time

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Destopia 2020-03-12 01:36:42 174 Initial revision (published)