In computational theory, complexity classes are used to categorize decision problems based on the resources (such as time or space) required to solve them. The concept of complexity classes is central to computational complexity theory, which helps us understand the limits of computation, classify problems, and analyze the efficiency of algorithms.
The primary goal is to group problems that share similar computational difficulty, based on resources like time and space. Complexity classes are an essential tool for determining whether a problem is solvable efficiently or if it is inherently hard to solve.
Decision Problems: These are problems that have a yes/no (binary) answer. For example, "Is this number prime?" is a decision problem.
Time Complexity: Refers to the amount of time an algorithm takes to solve a problem relative to the size of the input (usually denoted as ).
Space Complexity: Refers to the amount of memory or space required to solve a problem relative to the input size.
Resources: Complexity classes typically focus on resources like time (in terms of number of computational steps) or space (in terms of memory usage). These resources are often analyzed in the worst-case scenario, although average and best-case analyses can also be considered.
Definition: A decision problem is in P if it can be solved by a deterministic Turing machine in polynomial time. This means that the time taken to solve the problem can be bounded by a polynomial function of the input size.
Example Problems in P:
Importance: Problems in P are considered "efficiently solvable" since their running time grows relatively slowly as the size of the input increases.
Definition: A decision problem is in NP if a nondeterministic Turing machine can solve it in polynomial time. Alternatively, it is in NP if, given a candidate solution, it can be verified in polynomial time whether it is correct.
Example Problems in NP:
Importance: NP problems are significant because while we don't necessarily know how to solve them efficiently (in polynomial time), we can check the correctness of a solution efficiently.
Definition: A problem is NP-complete if:
Significance: NP-complete problems are considered to be the hardest problems in NP. If one NP-complete problem can be solved in polynomial time, all NP problems can be solved in polynomial time, which would imply that P = NP.
Example NP-Complete Problems:
Definition: A problem is NP-hard if every problem in NP can be reduced to it in polynomial time. However, unlike NP-complete problems, NP-hard problems do not have to be in NP (i.e., they do not necessarily have efficient solutions, nor must they be decision problems).
Example Problems:
Importance: Solving an NP-hard problem efficiently would not necessarily imply P = NP, but it would be a major breakthrough in computational complexity.
Definition: A decision problem is in Co-NP if its complement is in NP. In other words, for a problem in Co-NP, if the answer is "no," a certificate (or proof) of the "no" answer can be verified in polynomial time.
Example Problems in Co-NP:
Importance: Co-NP provides a different perspective on computational complexity, focusing on problems where we are interested in verifying the non-existence of a solution.
Definition: A decision problem is in PSPACE if it can be solved using polynomial space. The key difference between PSPACE and P is that PSPACE considers the space (memory) used by an algorithm, rather than the time.
Example Problems in PSPACE:
Importance: PSPACE allows for potentially much higher time complexity than P, but with strict bounds on space usage.
Definition: A decision problem is in EXPTIME if it can be solved by a deterministic Turing machine in exponential time. This means that the time complexity grows exponentially with the size of the input.
Example Problems in EXPTIME:
P is a subset of NP: If a problem can be solved in polynomial time (in P), it can be verified in polynomial time (in NP). However, it is still an open question whether .
NP-complete problems are a subset of NP: These are the hardest problems in NP, and if any NP-complete problem is solved in polynomial time, all NP problems can be solved in polynomial time (this would imply P = NP).
NP-hard problems are not necessarily in NP but are at least as hard as the hardest problems in NP.
Co-NP is the complement of NP: Problems in Co-NP are those for which a "no" answer can be verified efficiently.
PSPACE is a broader class than P and NP, focusing on space rather than time.
EXPTIME contains problems that require exponential time to solve, and many of these problems are too difficult to solve efficiently for large inputs.
Understanding complexity classes helps researchers classify problems, determine the feasibility of solving them, and design efficient algorithms.
Open this section to load past papers