+ 1

Time complexity for a loop?

I’m still confused about time complexity. Is a code O(1) if the number of times it loops is less than the Length of an array or is it O(n)?

13th Sep 2019, 4:23 PM
Jamie Charles
2 Réponses
+ 2
It depends on type of algorithm, quick sort, binary search, etcetera it is all about the expression, and nested loops. Jamie Charles
13th Sep 2019, 6:42 PM
Prantik Sarkar
Prantik Sarkar - avatar