


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



Greg Humphreys http://www.cs.virginia.edu/~humper CS150: Computer Science University of Virginia Computer Science
CS150 Fall 2005: Lecture 10: Measuring Work 2
CS150 Fall 2005: Lecture 10: Measuring Work (^4)
No, no matter what c we pick, cx^2 > x for big enough x
CS150 Fall 2005: Lecture 10: Measuring Work 7
Difference from O – this was < CS150 Fall 2005: Lecture 10: Measuring Work 8
CS150 Fall 2005: Lecture 10: Measuring Work (^9)
CS150 Fall 2005: Lecture 10: Measuring Work (^10)
(define (simple-sort cf lst) (if (null? lst) lst (let ((best (find-best cf lst))) (cons best (simple-sort cf (delete lst most)))))) (define (find-best cf lst) (insertl (lambda (c1 c2) (if (cf c1 c2) c1 c2)) lst (car lst)))
If we double the length of the list, we amount of work sort does approximately quadruples.
(insertone < 88 (list 1 2 3 5 6 23 63 77 89 90)) Suppose we had procedures
that quickly divided the list in two halves?