University of Virginia, Department of Computer Science CS200: Computer Science, Spring 2002

Notes: Wednesday 20 February 2002

• Friday, 22 February: Problem Set 4
• Monday, 25 February: Exam 1 Out (will be take-home, shouldn't take more than a few hours, but there will be no time limit; covers Lecture 1-13, Problem Sets 1-4, assigned readings through today)
• Wednesday, 27 February: Exam 1 Due
• Before 18 March: GEB all of Part I

Notes

Upper bound O ("big-oh"): 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.

• x2 is O (x2) — c = .5 works fine
• x2 is O (x3) — c = 1 works fine
• x3 is not O (x2) — for any choice of c, once x gets big enough c * x3 > x2
• Time to do bubblesort for a list of length n is O (n2) — 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.
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.
• x2 is Ω (x2) — c = 2 works fine
• x2 is not Ω (x3) — for any choice of c, once x gets big enough c * x2 < x3
• x3 is Ω (x2) — for any choice of c, once x gets big enough c * x3 > x2
• Time to do bubblesort for a list of length n is Ω (n2) — 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.
Tight bound Θ ("theta"): f(x) is Θ (g (x)) means that f(x) is O(g (x)) and f(x) is Ω (g (x)).
• x2 is Θ (x2) since x2 is O (x2) and x2 is Ω (x2).
• x2 is not Θ (x3) since x2 is not Ω (x3)
• x3 is not Θ (x2) since x3 is not O (x2)
• Time to do bubblesort for a list of length n is Θ (n2) since it is O (n2) and Ω (n2)
• 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 NP-complete?

What are the characteristics of NP-complete problems?

How would you convince someone the smiley puzzle is NP-complete?

Why are normal puzzle typically not NP-complete?