This is a sample code in algorithm book.