Presentation is loading. Please wait.

Presentation is loading. Please wait.

Complexity Classes.

Similar presentations


Presentation on theme: "Complexity Classes."— Presentation transcript:

1 Complexity Classes

2 Definitions Algorithms that have a polynomial complexity are algorithms whose run time is (nd) for some positive integer d. Algorithms that have an exponential complexity are algorithms whose run time is (cn) for some constant c greater than 1. It is clear that as n grows large, the exponential complexity algorithms may become impractical. (i.e. It may take many years of continuous computation in order to find the correct answer).

3 Complexity Classes This will be an informal discussion of the basics of this terminology. Much of the terminology refers to decision problems. A decision problem can be described as a problem that requires a “yes” or “no” answer. The class P refers to the set of all decision problems for which polynomial-time algorithms exist. (P stands for polynomial)

4 There is a larger class of decision problems called NP
There is a larger class of decision problems called NP. These problems have the property that, for any problem instance for which the answer is “yes”, there exists a proof that the answer is “yes” that can be verified by a polynomial-time algorithm. (NP stands for “non-deterministic polynomial”.) Note that we do not stipulate that here is any efficient method to find the given proof; we require only that a given hypothetical proof can be checked for validity by a polynomial-time algorithm.

5 It is not difficult to show that P  NP
It is not difficult to show that P  NP. It seems likely that NP is a much larger class than P, but this is unproven at present. Example: Vertex Coloring of a graph G, with exactly k colors. This problem is a decision problem. An algorithm that “solves” it is required only to give the correct answer “yes” or “no”. Let us first observe that this problem is in the class NP. If the graph G does have a k-coloring, then the color itself can serve as the desired proof. To verify that a given color is in fact a k-coloring, it suffices to consider every edge of G and check to see if the two vertices have received different colors.

6 Although verifying that a given function color is a k-coloring is easy,it does not seem so easy to find color in the first place. Even if we fix k=3, then there is no known polynomial-time algorithm for this problem. (On the other hand, if k=2, then the resulting problem is in the class P. A graph G has a 2-coloring iff it is bipartite. IN fact, Vertex coloring is generally believed to be in the class NP\P. There is further evidence to support this conjecture, beyond the fact that no one has managed to find a polynomial-time algorithm to solve it. Vertex coloring turns out to be one of the so-called NP-complete problems. Another NP-complete problem is Hamiltonian Cycles.


Download ppt "Complexity Classes."

Similar presentations


Ads by Google