Time complexity for a loop? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 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
1 Réponse
+ 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