For each item in the items list passed as a parameter to display_all_cubes function, the function finds the cube of the item and then displays it on the screen. If you double the elements in the input list, the steps needed to execute the display_all_cubes function will also be doubled. For the functions, with linear complexity, you should see a straight line increasing in positive direction as shown below:

xxxxxxxxxx14
import numpy as npimport matplotlib.pyplot as pltnum_of_inputs = np.array([1,2,3,4,5,6,7])steps = [2*n for n in num_of_inputs]plt.plot(num_of_inputs, steps, 'r')plt.xlabel('Number of inputs')plt.ylabel('Number of steps')plt.title('O(n) Complexity')plt.show()# No matplotlib support in this terminal.# Go to the next screen for the results!OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment


