This function takes a number and calculates its factorial using recursion.
def factorial(n): if n == 0: return 1 else: return n * factorial(n-1)
How does the running time increase w.r.t the input?
The number of recursions is determined by the size of the input: .
What is the time complexity?
This workbook was created by Jad and Rayan Slim. Feel free to explore some of their courses:
The Complete Java Development Bootcamp
The Complete Spring Boot Development Bootcamp – Become a Java Web Developer
There are no written reviews yet.