Prove that the vertex cover problem (does there exist a subset S of k vertices in a graph G such that every edge in G is incident upon at least one vertex in S?) remains NP-complete even when all the vertices in the graph are restricted to have even degree.
An instance of the set cover problem consists of a set X of n elements, a family F of subsets of X, and an integer k. The question is, do there exist k subsets from F whose union is X?
For example, if and
, there does not exist a solution
for k=2 but there does for k=3 (for example,
).
Prove that set cover is NP-complete with a reduction from vertex cover.
The baseball card collector problem is as follows.
Given packets , each of which contains a subset of that
year's baseball cards, is it possible to collect all the year's cards
by buying
packets?
For example, if the players are and
the packets are
there does not exist a solution for k=2 but there does for k=3, such as
Prove that the baseball card collector problem is NP-hard using a reduction from vertex cover.
The low degree spanning tree problem is as follows. Given a graph G and an integer k, does G contain a spanning tree such that all vertices in the tree have degree at most k (obviously, only tree edges count towards the degree)? For example, in the following graph, there is no spanning tree such that all vertices have degree less than three.
Given a directed acyclic graph G (a DAG), give an O(n+m)-time algorithm to test whether or not it contains a Hamiltonian path. (Hint: think about topological sorting and DFS.)
Give a polynomial-time algorithm to solve 2-SAT.
PrimalityTesting(n)
composite :=
![]()
for i := 2 to n-1 do
if
then
composite :=
![]()