P Problems Are In NP |
|
Any problem A that's in time complexity class P
is also in class NP.
|
Take any problem A that's in class P. We want to show that it's in NP, and to do that we need to show that any alleged solution to a given instance can be checked in polynomial time.
So consider an instance I and an alleged solution S. We need to show that S can be checked in polynomial time.
But A is in P, so we can actually solve it in polynomial time. So solve it (taking polynomial time) and then check the real solution against the alleged solution. That tells us whether the alleged solution is valid.
Thus we have checked the alleged solution, and it's taken us only polynomial time. Hence A is in NP.