Analyze function2 with respect to the length of the mystring. Hint, You will need to set up
Question:
Analyze function2 with respect to the length of the mystring. Hint, You will need to set up two mathematical functions for operator counting. one for function2 and the other for recursive_function2
def recursive_function2(mystring,a, b): if(a >= b ): return True else: if(mystring[a] != mystring[b]): return False else: return recursive_function2(mystring,a+1,b-1) def function2(mystring): return recursive_function2(mystring, 0,len(mystring)-1)
function 3 :
Analyze the following function with respect to the number
def function3(value, number): if (number == 0): return 1 elif (number == 1): return value else: half = number // 2 result = function3(value, half) if (number % 2 == 0): return result * result else: return value * result * result
CAN YOU DO BOTH THE FUNCTIONS USING THESE 5 STEPS
Step 1: Establish variables and functions (mathematical ones):
Step 2: Count your operations
Step 3: Establish the Mathematical Expression for T(n)
Step 4: Simplify your Equation
Step 5: State your final result.
Step 3: Establish the Mathematical Expression for T(n)
Step 4: Simplify your Equation
Step 5: State your final result.
CAN YOU ALSO DO THE MATHEMATICAL EXPRESSION FOR T(n) BESIDE THE LINES OF CODE
LASTLY THIS IS PYTHON PROGRAMMING.
Auditing An International Approach
ISBN: 978-0071051415
6th edition
Authors: Wally J. Smieliauskas, Kathryn Bewley