CS200: Computer Science, Spring 2002

Notes: Wednesday 20 February 2002
Schedule
 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
Notes Upper bound O ("bigoh"): f(x) is O (g (x)) means there is a positive constant c such that c * f(x) < g(x) for all but a finite number of x values.
Lower bound Ω ("omega"): f(x) is Ω (g (x)) means there is a positive constant c such that c * f(x) > g(x) for all but a finite number of x values.
 x^{2} is O (x^{2}) — c = .5 works fine
 x^{2} is O (x^{3}) — c = 1 works fine
 x^{3} is not O (x^{2}) — for any choice of c, once x gets big enough c * x^{3} > x^{2}
 Time to do bubblesort for a list of length n is O (n^{2}) — the value of c depends on how fast our computer is
 Time to solve smiley puzzle with n tiles is O (n!) — we know how to solve it in c * n! time for some constant c by trying all possible arrangements.
 Time to solve smiley puzzle might or might not be O (n) — we don't know of an O (n) procedure to solve it, but we can't prove one does not exist either.
Tight bound Θ ("theta"): f(x) is Θ (g (x)) means that f(x) is O(g (x)) and f(x) is Ω (g (x)).
 x^{2} is Ω (x^{2}) — c = 2 works fine
 x^{2} is not Ω (x^{3}) — for any choice of c, once x gets big enough c * x^{2} < x^{3}
 x^{3} is Ω (x^{2}) — for any choice of c, once x gets big enough c * x^{3} > x^{2}
 Time to do bubblesort for a list of length n is Ω (n^{2}) — the value of c depends on how fast our computer is
 Time to solve smiley puzzle with n tiles is might be or might not be Ω (n!) — no one knows if there is a solution to the smiley puzzle that is faster than c * n!
 Time to solve smiley puzzle is Ω (n) — we do know that there is no solution to the smiley puzzle that is faster than c * n since any solution involves at least looking at each tile once.
 x^{2} is Θ (x^{2}) since x^{2} is O (x^{2}) and x^{2} is Ω (x^{2}).
 x^{2} is not Θ (x^{3}) since x^{2} is not Ω (x^{3})
 x^{3} is not Θ (x^{2}) since x^{3} is not O (x^{2})
 Time to do bubblesort for a list of length n is Θ (n^{2}) since it is O (n^{2}) and Ω (n^{2})
 Time to solve smiley puzzle with n tiles might or might not be Θ (n!) since it is O (n!) but we don't know if it is Ω (n!) .
 Time to solve smiley puzzle might or might not be Θ (n) since it is Ω (n) but we don't knof it it is O (n).
What is the difference between a tractable and intractable problem?
What does it mean for a problem to be NPcomplete?
What are the characteristics of NPcomplete problems?
How would you convince someone the smiley puzzle is NPcomplete?
Why are normal puzzle typically not NPcomplete?
University of Virginia Department of Computer Science CS 200: Computer Science 
David Evans evans@virginia.edu Using these Materials 