Unformatted text preview: When a process has this structure, Scheme does not need extra memory to remember all the unfinished tasks during the computation. This is really not a big deal. For the purposes of this course, you should generally use the simpler linear recursive structure and not try for the more complicated iterative structure; the efficiency saving is not worth the increased complexity. The reason Abelson and Sussman make a fuss about it is that in other programming languages any program that is recursive in form (i.e., in which a function invokes itself) will take (at least) linear space even if it could theoretically be done iteratively. These other languages have special iterative syntax ( for , while , and so on) to avoid recursion. In Scheme you can use the functioncalling mechanism and still achieve an iterative process. • More is less: nonobvious efficiency improvements. The n th row of Pascal’s triangle contains the constant coefficients of the terms of ( a + b ) n . Each number in Pascal’s triangle is the sum of the two numbers above it. So we can write a function to compute thesein Pascal’s triangle is the sum of the two numbers above it....
View
Full Document
 Spring '10
 Harvey,B
 pascal row col, newpascal row col

Click to edit the document details