Big O
Why is Algorithm Analysis Important?
'''Alogrithm by Employee 1'''
def fact(n):
product = 1
'''Uses for loop'''
for i in range(n):
product = product * (i+1)
return product
%timeit fact(50)
################################
'''Alogrithm by Employee 2'''
def fact(n):
if n == 0:
return 1
else:
'''Uses recursive call'''
return n * fact(n-1)
%timeit fact(50)Algorithm Analysis with Big-O Notation

Analogy
Time Complexity
Big O of DS Algorithms

Last updated