Data Structures in Java
Session 22 Instructor: Bert Huang http://www.cs.columbia.edu/~bert/courses/3134
Data Structures in Java Session 22 Instructor: Bert Huang - - PowerPoint PPT Presentation
Data Structures in Java Session 22 Instructor: Bert Huang http://www.cs.columbia.edu/~bert/courses/3134 Announcements Homework 5 solutions posted Homework 6 to be posted this weekend Final exam Thursday, Dec. 17 th , 4-7 PM,
Session 22 Instructor: Bert Huang http://www.cs.columbia.edu/~bert/courses/3134
(this room)
(open book/notes)
Turing Award Winner 2009. 11 AM Monday. Davis Auditorium, CEPSR/Schapiro
Disk 3 Disk 2 Disk 1 Disk 0
Disk 3 Disk 2 Disk 1 Disk 0
Disk 3 Disk 2 Disk 1 Disk 0
Disk 3 Disk 2 Disk 1 Disk 0
Disk 3 Disk 2 Disk 1 Disk 0
complexity of problems
theory, and also for practice
helps us build better algorithms
every edge exactly once?
visits every node exactly once?
that visits every node exactly once?
nondeterministic computer
problem in NP is polynomially reducible to it
problem
P NP Undecidable NP-Complete NP-Hard
solvable in polynomial time
time is considered efficient
considered tractable
computer
check every possible solution in parallel
used to solve any other NP problem
Coloring etc.
input and output of algorithms
complex as all NP-Complete problems
determine if the computer program will finish
have an algorithm that detects infinite loops
itself
LOOP(P): If P(P) will halt: infinite loop If P(P) runs forever: output
LOOP(LOOP): If LOOP(LOOP) will halt: infinite loop If LOOP(LOOP) runs forever: output
lower bound on any NP-Complete problems,
algorithm for an NP-complete problem
class but not the other;
P?
P? NP Undecidable NP-Complete NP-Hard
every edge?
need to backtrack (mark edges instead of nodes)
edges; run a DFS starting with that edge
until all edges are visited
2 3 1 5 6 4 7
7
2 3 1 5 6 4
1
7
2 3 1 5 6 4
1 2
7
2 3 1 5 6 4
1 2 3
7
2 3 1 5 6 4
1 2 3 1
7
2 3 1 5 6 4
1 2 3 1 4
7
2 3 1 5 6 4
1 2 3 1 4 3
7
2 3 1 5 6 4
1 2 3 1 4 3 6
7
2 3 1 5 6 4
1 2 3 1 4 3 6 4
7
2 3 1 5 6 4
1 2 3 1 4 3 6 4 5
7
2 3 1 5 6 4
1 2 3 1 4 3 6 4 5 2
7
2 3 1 5 6 4
1 2 3 1 4 3 6 4 5 2 6
7
2 3 1 5 6 4
1 2 3 1 4 3 6 4 5 2 6 7
7
2 3 1 5 6 4
1 2 3 1 4 3 6 4 5 2 6 7 5
we set variables to make expression true?
Theorem gave polynomial time procedure to convert any NP problem to a Boolean expression
Satisfiability, we can efficiently solve any NP problem
k colors all nodes so no adjacent nodes are the same color?
squares in a row, column and blocks are connected. k = 9
path that visits each node exactly once?
path that visits all nodes
Hamiltonian Path; set connected edge weight to constant, disconnected to infinity
http://www.tsp.gatech.edu/gallery/itours/usa13509.html