This text, extensively class-tested over a decade at UC Berkeley and UC San Diego, explains the fundamentals of algorithms in a story line that makes the material enjoyable and easy to digest. Emphasis is placed on understanding the crisp mathematical idea behind each algorithm, in a manner that is intuitive and rigorous without being unduly formal.
......(更多)
......(更多)
......(更多)
We're done: 15*25-34*11=1, so x=15 and y=-34
编写递归代码时最重要的有以下三点: * 递归总有一个最简单的情况——方法的第一条语句总是一个包含 return 的条件语句。 * 递归调用总是去尝试解决一个规模更小的子问题,这样递归慈恩那个收敛到最简单的情况。 * 递归调用的父问题和尝试解决的子问题之间不应该有交集。
......(更多)