CS116 Study Guide - Midterm Guide: Boolean Function

78 views4 pages

Document Summary

Cs 116 winter 2012 sos midterm review package. Purpose: using parameter names (effects, (when doing questions with mutation only, explains what is happening when the function is called. Testing: includes base case, includes all possible cases. Abstract list functions filter: (x -> boolean) (listof x) -> (listof y) Map: (x -> y) (listof x) -> (listof y) Not good to use in recursive problems. Ex: ((lambda (x y) (* x y)) 2 3) (cid:1) (* 2 3) (cid:1) 6. Constant o(1: independent of the size of the input. Linear o(n: proportional to the size of the input. Quadratic -- o(n2: proportional to the square of the size of the input. Exponential o(2n: as the size of input increases by 1, running time doubles. Contains a local function that includes an accumulator that stores the value-so-far. For template, see slide 7 in module 3 notes. Test for each cond in the main function and all helper and local functions.