Lab Quiz, Foundations of Computing, Week 3 -- Oct 10, 2000

Name:



  1. Write a procedure named f that, when applied to the sample arguments, returns the sample result. Your procedure may not include any quoted data.

    > (f '(a b c) '(d e f))
    (a d)
    








  2. Write a procedure named phase that takes a number as an argument. If the number is less than zero, it returns ice. If the number is greater than one hundred, it returns steam. Otherwise it returns water.









  3. Program A has a running time proportional to the number of items it must process --- it's complexity is O(n). Program B's running time is proportional to the square of the number of items -- it is O(n2). Both programs process a test set of 100 items in one minute.

    Can program A process 100,000 items a day?

    Can program B process 100,000 items a year?