Algorithms for Solving Unsatisfiability and Hamiltonian Path Problems, Assignments of Algorithms and Programming

Three problems that describe how to construct algorithms for determining the satisfiability of a boolean expression and finding a hamiltonian path in a graph using existing algorithms. The document also discusses the polynomial time complexity of these new algorithms based on the given assumptions about the existing algorithms.

Typology: Assignments

Pre 2010

Uploaded on 08/30/2009

koofers-user-s80
koofers-user-s80 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Practice Problems
1. Assume that you have an algorithm ALGS such that ALGS takes as input a
Boolean Expression E(x1, … , xn) and reports whether or not there is a
SATISFYING assignment for E. Show that using ALGS, you can build and
algorithm ALGF which takes as input a Boolean Expression E(x1, … , xn)
and either reports that E is NOT satisfiable or returns a satisfying assignment
for E. Further show that if ALGS runs in polynomial time in n (the number
of variables) that ALGF will also run in polynomial time in the number of
variables.
2. Assume that you have an algorithm H that takes as input a graph G and
outputs YES if G has a HAMILTONIAN cycle and outputs NO if G does
not have a Hamiltonian cycle. Show how to construct an algorithm F so that
when F is given G, either F reports that G has no Hamiltonian cycle, or F
outputs a Hamiltonian cycle for G. Show that if H runs in polynomial time
in n (the number of vertices in G) then F will also run in polynomial time in
n.
3. Assume that you have an algorithm HAM() such that HAM(G) takes as
input a graph G, and outputs YES iff G has a Hamiltonian path and NO
otherwise. Construct an algorithm HE() such that HE(G, v1, v2) takes as
input a graph G and two vertices of G: v1and v2, and outputs YES iff there is
a Hamiltonian path in G beginning at vertex v1, and terminating at vertex v2,
and outputs NO otherwise. Show that if HAM() runs in time polynomial in
n (the number of vertices of G), that HE() will also run in time polynomial in
n.

Partial preview of the text

Download Algorithms for Solving Unsatisfiability and Hamiltonian Path Problems and more Assignments Algorithms and Programming in PDF only on Docsity!

Practice Problems

  1. Assume that you have an algorithm ALGS such that ALGS takes as input a Boolean Expression E(x 1 , … , xn) and reports whether or not there is a SATISFYING assignment for E. Show that using ALGS, you can build and algorithm ALGF which takes as input a Boolean Expression E(x 1 , … , xn) and either reports that E is NOT satisfiable or returns a satisfying assignment for E. Further show that if ALGS runs in polynomial time in n (the number of variables) that ALGF will also run in polynomial time in the number of variables.
  2. Assume that you have an algorithm H that takes as input a graph G and outputs YES if G has a HAMILTONIAN cycle and outputs NO if G does not have a Hamiltonian cycle. Show how to construct an algorithm F so that when F is given G, either F reports that G has no Hamiltonian cycle, or F outputs a Hamiltonian cycle for G. Show that if H runs in polynomial time in n (the number of vertices in G) then F will also run in polynomial time in n.
  3. Assume that you have an algorithm HAM() such that HAM(G) takes as input a graph G, and outputs YES iff G has a Hamiltonian path and NO otherwise. Construct an algorithm HE() such that HE(G, v 1 , v 2 ) takes as input a graph G and two vertices of G: v 1 and v 2 , and outputs YES iff there is a Hamiltonian path in G beginning at vertex v 1 , and terminating at vertex v 2 , and outputs NO otherwise. Show that if HAM() runs in time polynomial in n (the number of vertices of G), that HE() will also run in time polynomial in n.