CS200: Computer Science, Spring 2002

Notes: Monday 18 February 2002
Schedule Link to All Code: http://www.cs.virginia.edu/cs200/notes/permutesort.ss
 Friday, 22 February: Problem Set 4
 Monday, 25 February: Exam 1 Out (will be takehome, shouldn't take more than a few hours, but there will be no time limit; covers Lecture 113, Problem Sets 14, assigned readings through today)
 Wednesday, 27 February: Exam 1 Due
 Before 18 March: GEB all of Part I
Permute Sort How much work is permutesort?(define (flatone lst) (if (null? lst) lst (append (car lst) (flatone (cdr lst))))) (define (allpermutations lst) (flatone (map (lambda (n) (if (= (length lst) 1) (list lst) ;; Only one permutation of 1length list (map (lambda (oneperm) (cons (nth lst n) oneperm)) (allpermutations (exceptnth lst n))))) (intsto (length lst))))) (define (issorted? cf lst) (or (null? lst) (= 1 (length lst)) (and (cf (car lst) (cadr lst)) (issorted? cf (cdr lst))))) (define (permutesort cf lst) (car (filter (lambda (lst) (issorted? cf lst)) (allpermutations lst))))
What is a problem?
What does it mean to say a problem is O (n^{2})?
What does it mean to say a problem is Ω (n^{2})?
What does it mean to say a problem is in P?
What does it mean to say a problem is in NP?
Are all problems in P also in NP?
Are all problems in NP also in P?
Note: this is the Millennium Prize Problem: The P versus NP Problem. Clay Mathematics Institute will give you $1M if you answer it, so you may need more space.
University of Virginia Department of Computer Science CS 200: Computer Science 
David Evans evans@cs.virginia.edu Using these Materials 