0% found this document useful (0 votes)
10 views5 pages

AOA_UNIT_5

The document provides an overview of complexity classes in computer science, specifically defining P, NP, NP-Hard, and NP-Complete problems. It explains the characteristics and examples of each class, highlighting the significance of Cook's Theorem, which established that the Boolean satisfiability problem (SAT) is NP-complete. The implications of these classifications are discussed, particularly in relation to the P vs NP problem and the understanding of computational problem difficulty.

Uploaded by

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

AOA_UNIT_5

The document provides an overview of complexity classes in computer science, specifically defining P, NP, NP-Hard, and NP-Complete problems. It explains the characteristics and examples of each class, highlighting the significance of Cook's Theorem, which established that the Boolean satisfiability problem (SAT) is NP-complete. The implications of these classifications are discussed, particularly in relation to the P vs NP problem and the understanding of computational problem difficulty.

Uploaded by

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

ANALYSIS OF ALGORITHM

UNIT – 5 :- PROBLEM CLASSES

# TOPIC - 1 :- DEFINITION OF P , NP-HARD AND NP-


COMPLETE PROBLEMS
n 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.
Complexity classes are useful in organising similar types of problems.

Types of Complexity Classes


This article discusses the following complexity classes:
1. P Class
2. NP Class
3. CoNP Class
4. NP-hard
5. 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 Greatest Common Divisor
2. Finding 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.
This class contains many problems that one would like to be able to solve effectively:
1. Boolean Satisfiabiltity Problem (SAT)
2. Hamiltonian Path Problem
3. Graph Coloring
Co-NP Class
Co-NP stands for the complement of NP Class. It means if the answer to a problem in Co-NP
is No, then there is proof that can be checked in polynomial time.
Features:
• If a problem X is in NP, then its complement X’ is also in CoNP.
• For an NP and CoNP problem, there is no need to verify all the answers at once in
polynomial time, there is a need to verify only one particular answer “yes” or “no” in
polynomial time for a problem to be in NP or CoNP.
Some example problems for CoNP are:
1. To Check Prime Number
2. Integer Fcatroization
NP-Hard Problems
• Definition: A problem is said to be NP-Hard if it is at least as hard as the hardest
problems in NP. In other words, an NP-Hard problem is one for which no efficient
solution algorithm is known, and every problem in NP can be reduced to it in
polynomial time. Importantly, NP-Hard problems are not necessarily in NP—they
may or may not be decision problems (problems that have a yes/no answer).
• Characteristics:
o NP-Hard problems might not have a solution that can be verified in
polynomial time (which is a requirement for NP problems).
o Solving an NP-Hard problem is at least as hard as solving the hardest NP
problems.
o There is no known polynomial-time algorithm to solve NP-Hard problems.
• Example:
o Halting Problem: One of the most famous NP-Hard problems is the Halting
Problem, where the task is to determine, given a program and an input,
whether the program will eventually halt or run forever. This problem is not in
NP because it cannot be solved in polynomial time, and there is no algorithm
that can always solve it. It's NP-Hard because it is at least as hard as any
problem in NP.
o Travelling Salesman Problem (TSP) (in its optimization form): The decision
version of TSP (where the objective is to determine whether there exists a tour
shorter than a given length) is NP-Complete, but the optimization version
(finding the shortest possible tour) is NP-Hard.
2. NP-Complete Problems
• Definition: A problem is NP-Complete if:
o It belongs to NP (i.e., a solution to the problem can be verified in polynomial
time).
o Every other problem in NP can be reduced to it in polynomial time.
o In other words, NP-Complete problems are both in NP and NP-Hard. They are
the hardest problems in NP because any NP problem can be reduced to an NP-
Complete problem in polynomial time.
• Characteristics:
o NP-Complete problems are both hard to solve and hard to verify.
o If a polynomial-time algorithm is found for one NP-Complete problem, it
would imply that all NP problems can be solved in polynomial time (i.e., P =
NP).
• Examples:
o Boolean Satisfiability Problem (SAT): The SAT problem is one of the classic
NP-Complete problems. The task is to determine if there exists an assignment
of truth values to variables such that a Boolean formula is satisfied. SAT was
the first problem proven to be NP-Complete.
o Knapsack Problem (0/1 Knapsack): Given a set of items, each with a weight
and a value, the task is to determine the most valuable subset of items that can
be carried without exceeding a weight limit. The decision version of this
problem is NP-Complete.
o Travelling Salesman Problem (TSP) (in its decision form): The problem of
determining whether there exists a tour that visits each city once and returns to
the starting point with a total distance less than or equal to a given limit is NP-
Complete.

# TOPIC – 03 :- COOK’S THEOREM


Cook's Theorem is a groundbreaking result in the field of computational complexity, proven
by Stephen Cook in his seminal 1971 paper. It establishes that the Boolean satisfiability
problem (SAT) is NP-complete. This was the first problem to be proven as NP-complete,
and it laid the foundation for the development of computational complexity theory.
Statement of Cook's Theorem
The theorem states:
"The Boolean satisfiability problem (SAT) is NP-complete."
This means:
1. SAT is in NP (the class of problems that can be verified in polynomial time).
2. Every other problem in NP can be reduced to SAT in polynomial time. That is, any NP
problem can be transformed into SAT in such a way that solving SAT would solve the
original problem efficiently.
Why is this important?
Before Cook's Theorem, no one had proven that a specific problem in NP was as hard as
every other problem in NP. Cook's work showed that SAT, a simple and well-understood
problem, was not just in NP but was representative of the difficulty of all NP problems. It
created a blueprint for proving that other problems are NP-complete.
Understanding Cook's Theorem in Detail:
1. SAT Problem:
o The Boolean satisfiability problem asks whether there exists an assignment of
truth values to variables in a Boolean formula such that the formula evaluates
to true. A typical Boolean formula consists of logical operations like AND,
OR, and NOT applied to variables.
2. Reduction to SAT:
o Cook’s Theorem shows that any problem in NP can be reduced to SAT. This is
called a polynomial-time reduction. The idea is that if we could solve SAT
efficiently, we could solve any NP problem efficiently. For example, given an
arbitrary NP problem, we can convert it into a Boolean formula and ask if that
formula is satisfiable.
3. The Concept of NP-Completeness:
o The result is significant because it introduced the concept of NP-
completeness. SAT was the first problem proven to be NP-complete, meaning
it is as hard as any problem in NP, and if we could find a polynomial-time
solution for SAT, we would be able to solve all NP problems in polynomial
time.
The Impact of Cook's Theorem
Cook’s Theorem had several profound implications:
1. NP-complete Problems:
o It set the stage for the discovery of many other NP-complete problems. Once
SAT was shown to be NP-complete, it became a template for proving other
problems were NP-complete. A common approach is to reduce SAT to another
problem to show it’s also NP-complete. For example, problems like the
Travelling Salesman Problem and Graph Coloring were later shown to be
NP-complete.
2. Understanding the Difficulty of NP Problems:
o It provided a concrete understanding of what it means for a problem to be
"hard" within NP. SAT was now a benchmark, and if we could find an efficient
algorithm for SAT, it would imply that we can efficiently solve all NP
problems.
3. P vs NP Problem:
o Cook’s result is central to the famous P vs NP problem, which asks whether
every problem whose solution can be verified in polynomial time (NP) can
also be solved in polynomial time (P). If a polynomial-time algorithm for SAT
were found, it would imply that P = NP, which would have huge implications
for fields such as cryptography, optimization, and more.

You might also like