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

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.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Lets analyze both function2 and function3 in terms of their time complexity using the five steps you mentioned Function 2 Analysis Step 1 Establish va... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!