Comp210: Principles of Computing and Programming
Fall 2004 -- Lecture #12   


Review for Exam 1

See the Exam Resources

Example of the same function written with both forward and reverse accumulation: sumbig.scm (New and improved! With alternate implementations now!)

Example of the speed increase gained by using forward accumulation: speed_test.scm

Example of processing a list of abstract data structures: pizzalist.scm

Example of multiple accumulators: sumlast2.scm

Example of using both forward and reverse accumulation in the same function:

Consider the problem of detecting if a list contains any duplicate elements in a list. In pseudo-code we see:

The key is to write exactly what you think is supposed to be happening: duplicates.scm

 

 


Last Revised Tuesday, 24-Aug-2004 13:48:59 CDT

©2004 Stephen Wong and Dung Nguyen