Security and Cryptography in Python - Check the performance and understand how fast the space of permutations grows
Security and Cryptography in Python - Check the performance and understand how fast the space of permutations grows
def faculty(n):
if n <= 1:
return n
else:
return faculty(n-1)*n
for i in range(10):
print(faculty(i))
Running Result:
import cProfile
def faculty(n):
if n <= 1:
return n
else:
return faculty(n-1)*n
def counter(n):
cnt = 0
for i in range(n):
cnt += 1
return cnt
cProfile.run("counter(faculty(10))")
Running result (n=10):
Running result (n=11):
Running result (n=13):
相信未来 - 该面对的绝不逃避,该执著的永不怨悔,该舍弃的不再留念,该珍惜的好好把握。