Code from "The Art of Computer Programming"