0% found this document useful (0 votes)
35 views3 pages

Types of Complexity Classes

Uploaded by

2022002324.gcet
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views3 pages

Types of Complexity Classes

Uploaded by

2022002324.gcet
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

 In computer science, there exist some problems whose solutions are

not yet found, the problems are divided into classes known
as Complexity Classes.
 In complexity theory, a Complexity Class is a set of problems with
related complexity.
 These classes help scientists to group problems based on how much
time and space they require to solve problems and verify the
solutions.
 It is the branch of the theory of computation that deals with the
resources required to solve a problem.
 The common resources are time and space, meaning how much time
the algorithm takes to solve a problem and the corresponding
memory usage.
 The time complexity of an algorithm is used to describe the
number of steps required to solve a problem, but it can also be
used to describe how long it takes to verify the answer.
 The space complexity of an algorithm describes how much
memory is required for the algorithm to operate.

Types of Complexity Classes

1. P Class
2. NP Class
3. NP-hard
4. NP-complete

P Class

The P in the P class stands for Polynomial Time. It is the collection of


decision problems(problems with a “yes” or “no” answer) that can be
solved by a deterministic machine in polynomial time.
Features:
 The solution to P problems is easy to find.
 P is often a class of computational problems that are solvable and
tractable.
 Tractable means that the problems can be solved in theory as well as in
practice. But the problems that can be solved in theory but not in
practice are known as intractable.

This class contains many problems:


1. Calculating the greatest common divisor.
2. Finding a maximum matching.
3. Merge Sort

NP Class

 The NP in NP class stands for Non-deterministic Polynomial Time. It


is the collection of decision problems that can be solved by a non-
deterministic machine in polynomial time.

Features:

 The solutions of the NP class are hard to find since they are being
solved by a non-deterministic machine but the solutions are easy to
verify.
 Problems of NP can be verified by a Turing machine in polynomial
time.

NP-hard class

 An NP-hard problem is at least as hard as the hardest problem in NP


and it is a class of problems such that every problem in NP reduces to
NP-hard.

Features:

 All NP-hard problems are not in NP.


 It takes a long time to check them. This means if a solution for an NP-
hard problem is given then it takes a long time to check whether it is
right or not.
 A problem A is in NP-hard if, for every problem L in NP, there exists a
polynomial-time reduction from L to A.
 Some of the examples of problems in Np-hard are:

1. Halting problem.
2. Qualified Boolean formulas.
3. No Hamiltonian cycle.
NP-complete class

 A problem is NP-complete if it is both NP and NP-hard. NP-complete


problems are the hard problems in NP.

Features:

 NP-complete problems are special as any problem in NP class can be


transformed or reduced into NP-complete problems in polynomial
time.
 If one could solve an NP-complete problem in polynomial time, then
one could also solve any NP problem in polynomial time.
 Some example problems include:

1. Hamiltonian Cycle.
2. Satisfiability.
3. Vertex cover.

Complexity
Characteristic feature
Class

P Easily solvable in polynomial time.

NP Yes, answers can be checked in polynomial time.

All NP-hard problems are not in NP and it takes a long


NP-hard
time to check them.

NP-complete A problem that is NP and NP-hard is NP-complete.

You might also like