Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Kinds of Growth Here are some common orders of growth, ranked from no growth to fastest growth: 1. 0(1) - constant time takes the same
Kinds of Growth Here are some common orders of growth, ranked from no growth to fastest growth: 1. 0(1) - constant time takes the same amount of time regardless of input size 2. O(log n) logarithmic time 3. O(n) linear time 4. O(n log n) linearithmic time 5. O(n) 6. O(n), etc. polynomial time 7. O(2), O(34), etc. exponential time considered intractable"; these are really, really horrible) Complexity: Code Runtime You should create a parameter-free function called question1_2 and return a list with 10 numbers. You should put the corresponding growth rate (1 - 7) for each of the problems listed below. For example: Sample Question: for i in range(5, n+1): sum = sum + 1 Answer: 3 (linear time) Question 1.209 def func(n): j = n for i in (n, n+1): while j > 1: print (j) j = j7/2 Question 1.210 def func(lst, e): found = False while not found and len (1st) > 0: mid_idx = len (1st) // 2 if lst (mid_idx] == e: found = True else: if e 0: k = 0 while k 0: print (j) j = j // 3 Kinds of Growth Here are some common orders of growth, ranked from no growth to fastest growth: 1. 0(1) - constant time takes the same amount of time regardless of input size 2. O(log n) logarithmic time 3. O(n) linear time 4. O(n log n) linearithmic time 5. O(n) 6. O(n), etc. polynomial time 7. O(2), O(34), etc. exponential time considered intractable"; these are really, really horrible) Complexity: Code Runtime You should create a parameter-free function called question1_2 and return a list with 10 numbers. You should put the corresponding growth rate (1 - 7) for each of the problems listed below. For example: Sample Question: for i in range(5, n+1): sum = sum + 1 Answer: 3 (linear time) Question 1.209 def func(n): j = n for i in (n, n+1): while j > 1: print (j) j = j7/2 Question 1.210 def func(lst, e): found = False while not found and len (1st) > 0: mid_idx = len (1st) // 2 if lst (mid_idx] == e: found = True else: if e 0: k = 0 while k 0: print (j) j = j // 3
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started