University of Virginia Computer Science CS150: Computer Science, Fall 2005 |
(none) 16 September 2005 |
(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))) )))
"); print ( $res[$first] ) ; print (" |
CS 150: Computer Science University of Virginia |
evans@virginia.edu Using these Materials |