Please answer and explain the questions in image. The 1st and 2nd image is marked. Please explain how to get the answers. Charity only this much available sorry. Please explain B) def find_item...

Please answer and explain the questions in image. The 1st and 2nd image is marked. Please explain how to get the answers. Charity only this much available sorry. Please explain
B)<br>def find_item (mylist, item) :<br>if len (mylist)<br>return False<br>== 0:<br>else:<br>n = len (mylist)//2<br>print (

Extracted text: B) def find_item (mylist, item) : if len (mylist) return False == 0: else: n = len (mylist)//2 print ("Midpoint =", mylist[n] ) if mylist [n] == item: return True else: if item
Section 1- Algorithm Efficiency<br>Question 1.1<br>Assume that each of the expressions below gives the processing time T(n) spent by an algorithm for<br>solving a problem of input size n. Specify the dominant term having the steepest increase in n. What<br>is O() in each case? Give your answers by completing the table.<br>Expression<br>Dominant term<br>0()<br>5+ n+ 0.25n<br>500n + 50n*log(n)<br>200 + n/2<br>n + 2n + 0.5n² + 3n?<br>n+n5 + n05 + 20n<br>3n + n² + 7n + 10<br>Question 1.2<br>What is the time complexity of the following three algorithms? Express your answer in terms of Big-<br>O notation and justify your answer:<br>A)<br>def display_names_with_ID(names):<br>ID = 0;<br>for n in names:<br>print (

Extracted text: Section 1- Algorithm Efficiency Question 1.1 Assume that each of the expressions below gives the processing time T(n) spent by an algorithm for solving a problem of input size n. Specify the dominant term having the steepest increase in n. What is O() in each case? Give your answers by completing the table. Expression Dominant term 0() 5+ n+ 0.25n 500n + 50n*log(n) 200 + n/2 n + 2n + 0.5n² + 3n? n+n5 + n05 + 20n 3n + n² + 7n + 10 Question 1.2 What is the time complexity of the following three algorithms? Express your answer in terms of Big- O notation and justify your answer: A) def display_names_with_ID(names): ID = 0; for n in names: print ("ID for ", n, "is", ID) ID = ID + 1

Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here