CS200: Computer Science, Spring 2002

Notes: Friday 15 February 2002
Schedule Link to All Code: http://www.cs.virginia.edu/cs200/notes/universe.ss
 Friday, 22 February: Problem Set 4
 Before 18 March: GEB all of Part I
 Monday, 25 February: Exam 1 Out (will be takehome, shouldn't take more than a few hours, but there will be no time limit)
 Wednesday, 27 February: Exam 1 Due
Quick Sort (define (filter f lst) (insertlg (lambda (el rest) (if (f el) (cons el rest) rest)) lst null)) (define (quicksort cf lst) (if (null? lst) lst (append (quicksort cf (filter (lambda (el) (cf el (car lst))) (cdr lst))) (list (car lst)) (quicksort cf (filter (lambda (el) (not (cf el (car lst)))) (cdr lst))))))Secrets of the Universe (define (computingpower nyears) (if (= nyears 0) 1 (* 1.587 (computingpower ( nyears 1))))) ;;; doubling every 18 months = ~1.587 * every 12 months (define (simulationwork scale) (* scale scale scale)) ; Simulation is O(n^3) work (define (log10 x) (/ (log x) (log 10))) ;; primitive log is natural (base e) (define (knowledgeofuniverse scale) (log10 scale)) (define (findknowledgeofuniverse nyears) ;;; Size of simulation that can execute in nyears (define (findbiggestscale scale) (if (> (/ (simulationwork scale) 1000) ; we can simulate size 10 universe today (computingpower nyears)) ( scale 1) (findbiggestscale (+ scale 1)))) (knowledgeofuniverse (findbiggestscale 1)))Golden Ages
University of Virginia Department of Computer Science CS 200: Computer Science 
David Evans evans@virginia.edu Using these Materials 