Presentation is loading. Please wait.

Presentation is loading. Please wait.

Section 14.3 Complexity Classes

Similar presentations


Presentation on theme: "Section 14.3 Complexity Classes"— Presentation transcript:

1 Section 14.3 Complexity Classes
A complexity class is a set of problems related by how much time or space algorithms take to solve them. Complexity classes are usually defined for decision problems, which are problems that ask a question with a yes/no answer. Here are some fundamental complexity classes. The class P The set of problems that can be solved by deterministic algorithms with worst-case running times of polynomial order. The class NP The set of problems for which solutions can be verified by deterministic algorithms with worst-case running times of polynomial order. (The N stands for nondeterministic guess and the P stands for polynomial time to verify that the guess is a solution.) The class PSPACE The set of problems that can be solved by deterministic algorithms where the worst-case number of memory cells needed is of polynomial order. Intractable Problems The set of problems that are not in P. NP-Completeness Polynomially Reducible, NP-Competeness, CNF-Satisfiability, Cook’s Theorem, Algorithm to find NP-complete problem, Restricting CNF-Satisfiability.

2 Example The subset sum problem: given a positive integer A and a set B = {p1, ..., pn} of positive integers, is there a subset of B whose sum is A? Discussion: A simple deterministic algorithm to solve the problem would go through all the subsets of B looking for a subset whose elements summed to A. Since there are 2n subsets of B, this algorithm does not take polynomial time. But any subset can be checked with at most n – 1 additions.Thus there is a O(n) algorithm to do the checking. So the problem is in NP. The problem has been shown to be NP-complete.


Download ppt "Section 14.3 Complexity Classes"

Similar presentations


Ads by Google