SUNY Geneseo Department of Computer Science
Intractability
and Factoring
{Date}
CSci 141, Fall 2003
Prof. Doug Baldwin
Return to
List of Lectures
Previous Lecture
Misc
Hand out Homework 3
End-of-Semester
- SOFIs in class next Monday (12/8)
- Final
- Monday, Dec. 15, 8:00 AM
- Comprehensive but biased towards material since exam 2
- Same format and rules as hour exams
- Designed for 2 hours, 3 available
- Donuts & cider
- Sample questions will be on the Web
Questions?
Optimality of Towers of Hanoi
Last class we realized that the number of times the best Towers of Hanoi solver
moves a disk is
- B(n) >= 1 if n = 1
- B(n) >= 1 + 2B(n-1) if n > 1
Which we asserted has closed form B(n) >= 2n - 1
Mini-assignment: prove that this is the correct closed form for the recurrence
- Proof by induction on n
- Base case, n = 1
- B(n) >= 1 [from recurrence]
- >= 21 - 1 [from closed form]
- = 2 - 1
- = 1
- Induction hypothesis: assume k-1 is natural number and B(k-1) >= 2k-1
- 1
- Show B(k) >= 2k - 1
- B(k) >= 1 + 2B(k-1) [from recurrence]
- >= 1 + 2( 2k-1 - 1 ) [induction hypothesis]
- >= 1 + 2k - 2
- >= 2k - 1
Open Questions about Optimality
Read Section 16.3 (open problems)
- Open problem = any as-yet unsolved problem
- e.g., lower bound not known yet
- Tractable vs intractable problems
- Tractable = easy to solve, polynomial time
- Intractable = hard to solve, e.g., exponential
- Incomprehensible stuff
Factoring
Given a natural number, n, find 2 other smaller naturals a, b, such that n
= a*b
- e.g., 24 = 6 * 4
- or 123089475102834750128570129857120989182347512908734525890315729037 =
...
Factoring is solvable
factor(n)
for i = 2 to n-1
if n / i is a whole number
return < i, n/i >
Worst case: n-2 iterations of loop
But n isn't the right measure of problem size
- Number of digits, d, in n is
- Theta(n) = Theta(10d)
See thawte.com re SSL security, cryptography contests
Next Lecture