With three parameters and several loops, how do you spot the one loop that sets the Theta, and when do two loops multiply into n squared?
Short drills on what this video just taught. Write the code, run the checks, and reveal the answer only if you are stuck.
Here is compound from the video:
def compound(invest, interest, n_months): total=0 for i in range(n_months): total = total * interest + invest return total
For each parameter, give the running time of compound with respect to that parameter alone, holding the other two fixed. Use exactly one of the strings "Theta(1)" or "Theta(n)" (where is that parameter's value) for each entry of the dict costs.