0% found this document useful (0 votes)
13 views

Unit 5 Part 2

Uploaded by

star42348
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Unit 5 Part 2

Uploaded by

star42348
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 39

Tractable and Intractable

Problems
Example Kruskal Algorithm
https://www.youtube.com/watch?v=myhWOgjJoaI
Example Travelling Salesman Problem
Key Points
Given a set of cities and the distance between every pair of cities, the problem is to find the shortest possible
route that visits every city exactly once and returns to the starting point. Note the difference between
Hamiltonian Cycle and TSP. The Hamiltonian cycle problem is to find if there exists a tour that visits every city
exactly once. Here we know that Hamiltonian Tour exists (because the graph is complete) and in fact, many such
tours exist, the problem is to find a minimum weight Hamiltonian Cycle.

For example, consider the graph shown in the figure on the right side. A TSP tour in the graph is 1-2-4-3-1. The
cost of the tour is 10+25+30+15 which is 80. The problem is a famous NP-hard problem. There is no
polynomial-time know solution for this problem. The following are different solutions for the traveling salesman
problem.
Proving SAT is NP:

1. A certificate for an instance x of SAT consists of a truth assignment for the input variables of x.
2. The verification algorithm replaces each of the variables with the truth assignments from the
certificate, and evaluates the value of the expression, which can be done in polynomial time.
3. Since the expression can only evaluate to 1 if the formula is satisfiable, we have a polynomial-time
verification algorithm for SAT. That is, SAT is NP.

Proving SAT is NP-complete: We will reduce Circuit-SAT to SAT.

1. Let C be an instance of Circuit-SAT.


2. First, label each wire (including the inputs) in the circuit.
3. For each gate, create an expression that describes the proper operation of the gate.
4. For instance, if the circuit contains an OR gate with inputs x1, x2, and x3, and output x4, create the
expression (x1 ∨ x2 ∨ x3) ↔ x4. The formula we construct is the AND of the expression for each
gate and the final output of the gate. Clearly we can construct this formula in polynomial time.
If x is a satisfiable circuit, then there is a truth assignment for the inputs of the circuit such that
the output will be 1. Assigning these same values to the expression, including the correct results
for each gate, will result in a value of 1 for the expression as well. Conversely, assume x is not
satisfiable. Since the expression contains the output ANDed with the rest of the circuit, and the
output cannot be 1, neither can the expression. Thus x is satisfiable if and only if the
corresponding expression is.
Step 2 Construct a binary parse tree Tϕ1 for the formula ϕ1 with literals as leaves
and connectives as internal nodes
Primitive Recursive
Functions
Halting Problem
Given a program and input, can we have a generalized turing
machine that can say whether the program will halt or not?
Proof by Contradiction:

You might also like