Exercise 1 # collect timing data into arrays/lists here ns = np.linspace(1, 10000, 20, dtype=int) ts = [timeit.timeit('f1(lst)', setup='lst=list(range({}))'.format(n), number=10, globals=globals()) for n in ns] # plot your data and bounding functions here plt.plot(ns, ts, 'or'); plt.plot(ns, [0.0001 for n in ns], '-b') plt.plot(ns, [0.00015 for n in ns], '-g'); CONSTANT Exercise 2 # collect timing data into arrays/lists here ns = np.linspace(1, 100, 20, dtype=int) ts = [timeit.timeit('f2({})'.format(n), number=10, globals=globals()) for n in ns] # plot your data and bounding functions here plt.plot(ns, ts, 'or'); plt.plot(ns, [0.00002*math.log(n) for n in ns], '-b') plt.plot(ns, [0.00001*math.log(n) for n in ns], '-g'); LOGARITHMIC Exercise 3 # collect timing data into arrays/lists here ns = np.linspace(100, 1000, 20, dtype=int) ts = [timeit.timeit('f3(l)', setup='l = list(reversed(range({})))'.format(n), number=10, globals=globals()) for n in ns] # plot your data and bounding functions here plt.plot(ns, ts, 'or'); plt.plot(ns, [n*n*0.00000025 for n in ns], '-b') plt.plot(ns, [n*n*0.00000015 for n in ns], '-g'); QUADRATIC Exercise 4 # collect timing data into arrays/lists here ns = np.linspace(2, 15, 20, dtype=int) ts = [timeit.timeit('f4({})'.format(n), number=5, globals=globals()) for n in ns] # plot your data and bounding functions here plt.plot(ns, ts, 'or'); plt.plot(ns, [0.000005*2**n for n in ns], '-b') plt.plot(ns, [0.000001*2**n for n in ns], '-g'); 2^N Exercise 5 # collect timing data into arrays/lists here ns = np.linspace(100, 1000, 20, dtype=int) ts = [timeit.timeit('f5(l)', setup='l = list(range({}))'.format(n), number=5, globals=globals()) for n in ns] # plot your data and bounding functions here plt.plot(ns, ts, 'or'); plt.plot(ns, [0.0009*n for n in ns], '-b') plt.plot(ns, [0.0006*n for n in ns], '-g'); LINEAR