(NP Complete Problems)
Line 18: Line 18:
 
These problems need not have any bound on their running time. If any <math>NP</math> Complete Problem is polynomial time reducable to a problem, that problem belongs to <math>NP</math> Hard class. Hence, all <math>NP</math> Complete problems are also <math>NP</math> Hard. In other words if a <math>NP</math> Hard problem is non-deterministic polynomial time solvable, its a <math>NP</math> Complete problem. Example of a <math>NP</math> Hard problem that's not <math>NP</math> Complete is [https://en.wikipedia.org/wiki/Halting_problem Halting Problem].
 
These problems need not have any bound on their running time. If any <math>NP</math> Complete Problem is polynomial time reducable to a problem, that problem belongs to <math>NP</math> Hard class. Hence, all <math>NP</math> Complete problems are also <math>NP</math> Hard. In other words if a <math>NP</math> Hard problem is non-deterministic polynomial time solvable, its a <math>NP</math> Complete problem. Example of a <math>NP</math> Hard problem that's not <math>NP</math> Complete is [https://en.wikipedia.org/wiki/Halting_problem Halting Problem].
  
 +
 +
 +
<disqus/>
 
[[Category: Algorithms & Data Structures]]
 
[[Category: Algorithms & Data Structures]]

Revision as of 22:29, 16 November 2013

It might be because of the name but many graduate students find it difficult to understand <math>NP</math> problems. So, I thought of explaining them in an easy way. (When explanation becomes simple, some points may be lost. So, please do refer standard text books for more information)

<math>P</math> Problems

As the name says these problems can be solved in polynomial time, i.e.; <math>O(n)</math>, <math>O(n^2)</math> or <math>O(n^k)</math>, where <math>k</math> is a constant.

<math>NP</math> Problems

Some think <math>NP</math> as Non-Polynomial. But actually its Non-deterministic Polynomial time. i.e.; these problems can be solved in polynomial time by a non-deterministic Turing machine and hence in exponential time by a deterministic Turing machine. In other words these problems can be verified (if a solution is given, say if its correct or wrong) in polynomial time. Examples include all P problems. One example of a problem not in <math>P</math> but in <math>NP</math> is Integer Factorization.

<math>NP</math> Complete Problems

Over the years many problems in <math>NP</math> have been proved to be in <math>P</math> (like Primality Testing). Still, there are many problems in <math>NP</math> not proved to be in <math>P</math>. i.e.; the question still remains whether <math>P = NP</math> (i.e.; whether all <math>NP</math> problems are actually <math>P</math> problems).

<math>NP</math> Complete Problems helps in solving the above question. They are a subset of <math>NP</math> problems with the property that all other <math>NP</math> problems can be reduced to any them in polynomial time. So, they are the hardest problems in <math>NP</math> in terms of running time. Also, if anyone can show that an <math>NP</math> Complete Problem is in <math>P</math>, then all problems in <math>NP</math> will be in <math>P</math>, and hence <math>P = NP = NPC</math>.

All <math>NP</math> Complete problems are in <math>NP</math> because of the definition. Examples of <math>NP</math> Complete problems

<math>NP</math> Hard Problems

These problems need not have any bound on their running time. If any <math>NP</math> Complete Problem is polynomial time reducable to a problem, that problem belongs to <math>NP</math> Hard class. Hence, all <math>NP</math> Complete problems are also <math>NP</math> Hard. In other words if a <math>NP</math> Hard problem is non-deterministic polynomial time solvable, its a <math>NP</math> Complete problem. Example of a <math>NP</math> Hard problem that's not <math>NP</math> Complete is Halting Problem.


blog comments powered by Disqus

It might be because of the name but many graduate students find it difficult to understand <math>NP</math> problems. So, I thought of explaining them in an easy way. (When explanation becomes simple, some points may be lost. So, please do refer standard text books for more information)

<math>P</math> Problems[edit]

As the name says these problems can be solved in polynomial time, i.e.; <math>O(n)</math>, <math>O(n^2)</math> or <math>O(n^k)</math>, where <math>k</math> is a constant.

<math>NP</math> Problems[edit]

Some think <math>NP</math> as Non-Polynomial. But actually its Non-deterministic Polynomial time. i.e.; these problems can be solved in polynomial time by a non-deterministic Turing machine and hence in exponential time by a deterministic Turing machine. In other words these problems can be verified (if a solution is given, say if its correct or wrong) in polynomial time. Examples include all P problems. One example of a problem not in <math>P</math> but in <math>NP</math> is Integer Factorization.

<math>NP</math> Complete Problems[edit]

Over the years many problems in <math>NP</math> have been proved to be in <math>P</math> (like Primality Testing). Still, there are many problems in <math>NP</math> not proved to be in <math>P</math>. i.e.; the question still remains whether <math>P = NP</math> (i.e.; whether all <math>NP</math> problems are actually <math>P</math> problems).

<math>NP</math> Complete Problems helps in solving the above question. They are a subset of <math>NP</math> problems with the property that all other <math>NP</math> problems can be reduced to any them in polynomial time. So, they are the hardest problems in <math>NP</math> in terms of running time. Also, if anyone can show that an <math>NP</math> Complete Problem is in <math>P</math>, then all problems in <math>NP</math> will be in <math>P</math>, and hence <math>P = NP = NPC</math>.

All <math>NP</math> Complete problems are in <math>NP</math> because of the definition. Examples of <math>NP</math> Complete problems

<math>NP</math> Hard Problems[edit]

These problems need not have any bound on their running time. If any <math>NP</math> Complete Problem is polynomial time reducable to a problem, that problem belongs to <math>NP</math> Hard class. Hence, all <math>NP</math> Complete problems are also <math>NP</math> Hard. In other words if a <math>NP</math> Hard problem is non-deterministic polynomial time solvable, its a <math>NP</math> Complete problem. Example of a <math>NP</math> Hard problem that's not <math>NP</math> Complete is Halting Problem.