The example from "Introduction to Algorithm, 3rd Edition", by scala.