Day 19


For Next time

Appendix B Debrief

With two folks sitting around you, discuss the following questions:

  1. What are some of the challenges in comparing the efficiency of two algorithms?
  2. How does order of growth analysis address these challenges?
  3. In what situations might order of growth analysis be misleading (or at least tell an incomplete story)?
  4. Review your answers to Appendix B Problem 1 (from the reading journal). If there is confusion about one of the answers, take some time to discuss it at your table in more detail (or use the whiteboard). If any questions come up that you’d like to raise with the whole class, there will be some time to do so following your small group discussions.

Practice with Order of Growth

Suppose we are given two python functions do_procedure_f1 and do_procedure_f2. Each function processes a list L in some fashion (what these programs do is unimportant for this exercise). We are told that the order of growth of these procedures is:

What are the order of growths of the following computations?

def run_computation_1(L):

def run_computation_2(L):

def run_computation_3(L):
    for i in range(len(L)):

def run_computation_4(L):
    for i in range(len(L)):

def run_computation_5(L):
    if len(L) % 2 == 0:

def run_computation_6(L):
    if len(L) == 1:
        return 1

Order of Growth for Basic Python Operations

You have read Think Python Appendix B.1 and B.2. One of the most important takeaways is the listing of the order of growth for various operations on Python data structures. Here are some key points:

Empirical Analysis of Order of Growth

You should have received an invitation to a CoCalc project that Allen created. Next, you’ll be doing some exercises from this notebook.

This is an experiment, so as a backup in case you have issues with CoCalc, the notebook is available as part of the SoftDes website.

A couple of things to keep in mind when interpreting the results graphically:

After you’ve completed the exercise, please help us out by completing this survey about your impressions of the exerience with CoCalc.

Project work time

A few things we’ve observed from several teams, along with some advice to keep in mind at this point in the project: