Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

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... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Auditing An International Approach

Authors: Wally J. Smieliauskas, Kathryn Bewley

6th edition

978-0070968295, 9781259087462, 978-0071051415

More Books

Students also viewed these Programming questions

Question

What is the essence of the risk reduction definition of auditiong.

Answered: 1 week ago