If 5-vertex cover is in P with O(n^5), then 100 vertex cover is in P with O(n^100) - so generally we can say vertex cover problem is in P!
But why is the vertex cover problem in NP?
If 5-vertex cover is in P with O(n^5), then 100 vertex cover is in P with O(n^100) - so generally we can say vertex cover problem is in P!
But why is the vertex cover problem in NP?
First, let's rephrase the vertex cover problem as a decision problem instead of an optimization problem. The decision problem format asks the question "Is there a vertex cover to graph G using k vertices?" where the input includes both G and k - the maximal number of vertices required. We will denote by n, the number of vertices of the graph G.
Sure, for any fixed value of k, there is a solution in O(n^k), but the problem, is k is an input to the problem and may be as large as n/2. If you were to take a naive approach and test with an O(n^k) algorithm, you would require in your worst case, (n^(n/2)), which is certainly not a polynomial over the size of the inputs.