Cse 421 HW 8
Cse 421 HW 8
If P = NP, then there is a polynomial time algorithm that, given a 3SAT formula, finds a
satisfying assignment to the formula, if there is one. To produce a satisfying assignment
for a formula A, first try substituting the variables x0 = 0 and x1 = 1 into the formula and
see which of A with x0 or A with x1 is satisfiable. One of them has to be because A is
satisfiable by our assumption. Whichever substitution works, make it permanent in A.
Continue substituting with x2 as the new 1 or 0 substitute, and continue the cycle of
keeping whichever formula is satisfiable until all xi are found. This algorithm will
examine a new node each time it iterates through, so it runs in O(n) times, which is
polynomial.
2. If A is the problem of factoring in polynomial time, we are looking for a factor f of the
integer n in the range a < b. Since f is the certificate, A is in NP. We are assuming P =
NP, which means there exists a polynomial algorithm that solves the above problem. We
can use binary search to search halved areas of the range from a < b/2, a + b/2 < b, and if
there isn’t a factor in one half then we know there is in the other half. Through the
recursive algorithm it will run at most log(n) times for each individual value, and it could
do that up to n times for each factor, making the runtime nlog(n), which is bounded by n2
which is polynomial, and thus the algorithm itself is polynomial.