Code in 《Algorithms 4th》