Resources: Python 3 Documentation Documentation Python Lab 6 Materials
Files Needed:
Write a program that uses a recursive function to solve for a factorial. It should call a function that uses the linear search algorithm to locate one of the values. The function should keep a count of the number of comparisons it makes until it finds the value. The program then should call a function that uses the binary search algorithm to locate the same value. It should also keep count of the number of comparisons it makes. Display these values on the screen.
Psuedo Code Implementation to find the factorial of some value n.
n! = n * (n-1)! n! = 1 if n = 0 or n = 1 Example: 5! = 5 * 4 * 3 * 2 * 1 = 120
Function Header for factorial function taking an arugment n.
def factorial(n):
Conditions of Satisfactions
calling your function with the following values. factorial(2) should return 2 factorial(3) should return 6, factorial(4) should return24, factorial(5) should return 120.