Why is a correct program still not good enough, and what can a clock reading taken twice tell you about the cost of a call?
Short drills on what this video just taught. Write the code, run the checks, and reveal the answer only if you are stuck.
The memoized Fibonacci from the video keeps every value it has already worked out in a dictionary, so nothing is ever computed twice. Your memo already holds {1: 1, 2: 1, 3: 2, 4: 3}. Get the next Fibonacci number out of the memo alone — no recursion, nothing recomputed. Assign it to new_value; the starter then stores it in memo under the key 5.
Time efficiency and space efficiency
Record that programs must be correct and fast, then set the plain recursive Fibonacci beside the memoized version as the example of trading memory for speed.
Algorithms versus implementations
State that one algorithm has thousands of implementations, and list a for loop, a while loop, intermediate variables and a list comprehension as versions of one summing algorithm.
time.time() and the epoch
Write that time.time() returns the seconds elapsed since January 1, 1970, and trace the start-run-finish-subtract pattern that produces dt for a call to c_to_f(37).
The constant, linear and quadratic functions
Copy c_to_f, mysum and square onto the page, and mark for each one its loop structure and how many additions it performs on input n.