Unit 5 Part 2-1-23 - Converted (1)
Unit 5 Part 2-1-23 - Converted (1)
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.
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