Computer Science 61A - Spring 1997 - Harvey - Midterm 1

Computer Science 61A - Spring 1997 - Harvey - Midterm 1 -...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 61A CS 61A, Spring 97 Midterm 1 Professor Harvey Problem #1 (7 points): What will Scheme print in response to the following expression? If an expression produces an error message or runs forever without producing a result, you may just say "error"; you don't have to provide the exact text of the message. If the value of an expression is a procedure, just say "procedure"; you don't have to show the form in which Scheme prints procedures. Assume that no global variables have been defined before entering these expressions, except where noted. (se '(+ 2 3) (+ 2 3)) ((lambda (x y z) (+ x 5)) 6 7) ; from ex. 1.32, p. 61 (accumulate se 0 (lambda (x) x) 3 (lambda (x) (+ x 1)) 5) ((if 3 - *) 23 2) (a b c) (let ((a 5) (b (+ a 3))) (* a a)) ((lambda (f) (f f)) (lambda (f) f)) Problem #2 (2 points): True or false? A theta( nlog(n)) algorithm is, for all large enough n, slower than a theta ( n^2) one. _____ For small size inputs the theta order of an algorithm helps predict running time. _____ Function f below defines a linear iterative process:
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/17/2009 for the course CS 61A taught by Professor Harvey during the Spring '08 term at Berkeley.

Page1 / 3

Computer Science 61A - Spring 1997 - Harvey - Midterm 1 -...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online