def printer (n): if (n <= 0): return "please enter a number greater than 0" else: for i in xrange (0,n) print i what's the run time of this algo? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

def printer (n): if (n <= 0): return "please enter a number greater than 0" else: for i in xrange (0,n) print i what's the run time of this algo?

Algo runtime

6th Sep 2016, 6:59 AM
brian
2 Respuestas
+ 1
O(n)
6th Sep 2016, 7:03 AM
Amanuel Nega
Amanuel Nega - avatar
0
thank you Amanuel, could you kindly explain it for me, I'm having trouble understanding the runtime for algo's
6th Sep 2016, 7:05 AM
brian