University of Virginia Computer Science
CS150: Computer Science, Fall 2005

(none)
16 September 2005

CS150 Notes 11 (16 September 2005)

Upcoming Assignments

Notes
If you have two procedures that solve the same problem and procedure 1 is Θ(n3) and procedure 2 is Θ(n) how would you decide which is better for a particular problem instance?





(define (sublist lst start end)
  (if (= start 0)
      (if (= end 0) null
          (cons (car lst) (sublist (cdr lst) start (- end 1))))
      (sublist (cdr lst) (- start 1) (- end 1))))

(define (first-half lst) 
  (sublist lst 0  (floor (/ (+ 1 (length lst)) 2))))

(define (second-half lst)
  (sublist lst (floor (/ (+ 1 (length lst)) 2)) (length lst)))

(define (insertsorth cf lst)
  (if (null? lst) null 
      (insertelh cf (car lst) (insertsorth cf (cdr lst)))))

(define (insertelh cf el lst)
  (if (null? lst) 
      (list el)
      (let ((fh (first-half lst))
	    (sh (second-half lst)))







         )))
Golden Ages Links

"); print ( $res[$first] ) ; print (""); ?>
CS 150: Computer Science
University of Virginia
evans@virginia.edu
Using these Materials