Chapter 8 of Python algorithms