Solved by Expert Tutors
Exercises For the function provided in the first cell of each numbered exercise below, you will (1) state your hypothesized worst-case Big-O runtime
Solved by Expert Tutors
Question

Exercises<br/>For the function provided in the first cell of each

numbered exercise below, you will (1) state your hypothesized worst-case Big-O runtime complexity, (2) write code to collect timings for different sizes of input (it may take a bit of work to figure out how to come up with worst-case inputs!), and (3) plot the timings alongside bounding functions. As you work through an exercise, it's certainly possible that you may need to go back and revise your initial hypothesis. Note that the bounding functions must take the form  ⋅
c⋅g, where 
c is a constant multipler and 
g is your stated runtime complexity. E.g., for a  (
2
)
O(N2) function, your bounding functions will be of the form  ⋅
2
c⋅N2.
Each exercise already includes three cells beneath the provided function; simply fill them in with your own data. You are alotted a total of 30 seconds for all cells in the notebook to be evaluated, so you also need to be clever about collecting timings.
For each exercise, parts (1), (2), and (3) and worth 2 points each, giving a maximum score of 30 points for this lab.
Exercise 1
In [21]:






def f1(lst): r = 0 n = 100 if len(lst) &lt; n: n = len(lst) for x in range(n): r += x Read Only
Hypothesis: f1 = O(?) ← fill in your hypothesis here
In [22]:






# collect timing data into arrays/lists here ns = [] ts = [] Graded


Starter Code
In [ ]:




# plot your data and bounding functions here plt.plot(ns, ts, 'or') plt.plot(ns, [], '-g') plt.plot(ns, [], '-b');

Step-by-step answer

tesque darilooneccor nec facilisi0ur laoreet. Namsuipiscing elsa molestie consequat, ultrices ac magna. Fusce dui lectus,oritusucongue vel laoreet ac, dictum vitae odillentsus ante, dasuona moonamettrem iptipiscionnec faons a molongue veltec aliqueipiscing eorinisuultrices ac magna. Fususceitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laollentiscing elit. Nam lafur laoreet. Nam risusec aicitur laoreet.ipiscic, dictum vitnecicitur laoreet.aciiscic, dictum vitec fec aliquet. Loacinia pulvi

, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante,

a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Do

consectetur adipiscing elit. Nam lacinia p

Subscribe to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question