15.5 Summary

Wrapping up our asymptotics adventures.


  • There are no magic shortcuts for analyzing code runtime.
  • In our course, it’s OK to do exact counting or intuitive analysis.
  • Know how to sum 1 + 2 + 3 + ... + N and 1 + 2 + 4 + ... + N.
  • We won’t be writing mathematical proofs in this class.
  • Many runtime problems you’ll do in this class resemble one of the five problems from today.
  • This topic has one of the highest skill ceilings of all topics in the course. All the tools are here, but practice is your friend!
  • Different solutions to the same problem, e.g. sorting, may have different runtimes (with big enough differences for the runtime to go from impractical to practical!).
  • N2N^2
    ​​ vs.
    is an enormous difference.
  • Going from
    is nice, but not a radical change.
Hopefully, this set of examples has provided some good practice with the techniques and patterns of runtime analysis. You can also find extra practice problems in the next section. Remember, there are no magic shortcuts, but you have to tools to approach the problems. Go forth and analyze!!