0% found this document useful (0 votes)
1 views

Np Complet Problems

The document discusses NP-complete problems and computational complexity theory, highlighting the classification of problems into complexity classes such as P and NP. It explains the definition of NP-completeness, provides examples of NP-complete problems like SAT, Hamiltonian cycle, and Knapsack, and emphasizes the significance of these problems in algorithm design and computational methods. The conclusion reflects on the challenges posed by NP-complete problems and their implications for research in computer science.

Uploaded by

ghostw.bng
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)
1 views

Np Complet Problems

The document discusses NP-complete problems and computational complexity theory, highlighting the classification of problems into complexity classes such as P and NP. It explains the definition of NP-completeness, provides examples of NP-complete problems like SAT, Hamiltonian cycle, and Knapsack, and emphasizes the significance of these problems in algorithm design and computational methods. The conclusion reflects on the challenges posed by NP-complete problems and their implications for research in computer science.

Uploaded by

ghostw.bng
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/ 11

NP COMPLETE PROBLEMS

AND
NP COMPLETENESS
Supervised By Professor
By : :
Benlahlou Wassim Bezia Abdelhamid
Ait Hamadouche Haithem Idris
Bougrine Mourad
Bezzahi Hessam Eddine
Bouali Mouaadh
Ben Noui Mohamed El Hadi
Boussoar Oussama Ammar
Table of Content:

1-Introduction to Computational Complexity :


- the concept of computational complexity and its importance in computer science.
- the classes P and NP .

2-NP Completeness Definition and reduction :


- what it means for a problem to be NP-complete.
- how problems can be reduced to each other to prove NP-completeness.

3-Examples of NP-Complete Problems :


- SAT, Hamiltonian cycle problem, Knapsack, and Graph Coloring.

4-Coclusion :
1-Introduction to Computational Complexity
:
What is Computational Complexity Theory ? :
In theoretical computer science and mathematics, computational complexity theory is a theory that
focuses on classifying computational problems ( the problems that may be solved by an algorithm ,
for example : factoring a positive integer to the product of prime numbers ) according to their resource usage
and their complexity, and relating these classes to each other.

Why We Need Computational Complexity Theory ? :


we need computational complexity theory in many sevral reasons :
-It helps identify which problems can be efficiently solved and which are
inherently difficult.
-Computational complexity theory informs the design and analysis of algorithms
. By classifying problems into complexity classes such as P, NP, and NP-complete,
it guides algorithm designers in choosing appropriate strategies for tackling
different types of problems……
Figure 1
P problems :
A Problem is said to be in the P complexity class ( A P problem ) if it is a decision problem (produce output ‘Yes’
or ‘No’ ) that can be efficciently solved by a deterministic turing machine in polynomial time ( it is quick to solve )

example :
Linear search algorithm ( is defined as a search algorithm that start at one and goes through each element of a
list until the desired element is found, as we see in figure 2) whose time complexity is O(N) .

Remarques :
- A Turing Machine is a theoretical model of computation introduced by the
mathematician Alan Turing in 1936. It serves as the foundation of modern
computer science and is used to formalize the concept of algorithmic
computation. (All Algorithms can do by Turing machine then turing machine
Represent the computer) . Figure 2
- A deterministic Algorithm is an algorithm that will always produce the same output going through the same
states for a given particular input .
- An algorithm has polynomial time complexity if there exists a polynomial function 𝑓(𝑛) such that the algorithm's
running time 𝑇(𝑛) is bounded by 𝑓(𝑛) where 𝑛 is the size of the input and we denote the time of complexity of the
Algorithm by 𝑶(𝒇(𝒏)). ( then in worst case the time required for computation grows as a polynomial function 𝑓(𝑛)
of the input size 𝑛).
NP Problems :
A problem is said to be in The NP (nondeterministic polynomial time ) class if a proposed solution for the problem
can be verified in polynomial time by a deterministic Turing machine, In other words, if you're given a potential
solution , you can quickly check whether it's correct . However, finding the solution itself might be computationally
difficult.

Examples :
- Travling Salseman Problem (TSP)
- The Knapsack Problem
- The Boolean Satisfiability Problem (SAT)

Relationship between P and NP :


P is a subset of NP ! , in another words every problem that is quick to solve is also quick to verify his solution .
However, it's not known whether P equals NP or not. This question forms the basis of the famous P vs. NP
problem.
If P equals NP, it would mean that every problem for which a solution can be verified quickly can also be solved
quickly, with far-reaching implications for computer science, mathematics, and cryptography.
NP Complete problems :
The NP-completeness class is a set of decision problems within the complexity class NP (Nondeterministic
Polynomial-time) that are among the hardest problems in NP in terms of computational complexity. A problem is
considered NP-complete if it has two key properties:

1.In NP: The problem can be verified in polynomial time. This means that the problem is in the NP class

2.NP-Hardness: The problem is at least as hard as the hardest problems in NP. In other words, if there exists a
polynomial-time algorithm for any NP-complete problem, then there exists a polynomial-time algorithm for all
problems in NP, making them solvable in polynomial time.

Examples :
- Boolean Satisfiability Problem (SAT)
- Traveling Salesman Problem (TSP)
- Knapsack Problem
- Graph Coloring Problem
- Subset Sum Problem
- Clique Problem
Figure 3
- Hamiltonian Cycle Problem
Reduction Of NP Complete Problems :
If you have a problem A that is NP-complete and you can show
that another problem B can be transformed into problem A in
polynomial time, then you can conclude that problem B is also
NP-complete. This is because if you could solve problem B
efficiently, you could use the reduction to solve problem A
efficiently as well.

NP-complete reduction plays a crucial role in complexity theory. It


helps in identifying new NP-complete problems by showing that
they are at least as hard as known NP-complete problems. This
allows researchers to better understand the landscape of
computational complexity and the relationships between
different types of problems.

NP-completeness is based on the concept of reductions . Since a


Problem A is consider to be NP-hard if any problem in NP has a
polynomial time reduction with A .
Figure 4
in Figure 4 we show some examples of problems that are
commonly reduced to each other in NP completeness class
Examples Of NP Complete Problems :
1. Boolean Satisfiability Problem (SAT):

The SAT problem, short for Boolean satisfiability problem, is a fundamental question in computer science and
mathematical logic. It asks whether there exists an assignment of truth values (true or false) to a set of Boolean
variables that satisfies a given Boolean formula.

A Boolean formula is constructed using logical connectives such as AND, OR, and NOT. The formula is typically
given in conjunctive normal form (CNF), which is a conjunction (AND) of clauses, where each clause is a
disjunction (OR) of literals (variables or their negations).

For example, consider the formula (A OR B) AND (NOT A OR C) AND (B OR NOT C). The SAT problem asks
whether there exists an assignment of truth values to the variables A, B, and C such that the formula evaluates
to true.

The SAT problem is NP-complete, meaning that it is among the hardest problems in the complexity class NP
(nondeterministic polynomial time), and any problem in NP can be reduced to it in polynomial time. As a result,
solving the SAT problem efficiently would imply solving many other computationally difficult problems efficiently
as well
2. Hamiltonian cycle problem :

he Hamiltonian cycle problem is a classic problem in graph theory and computer science. It asks whether a given
graph contains a Hamiltonian cycle, which is a cycle that visits every vertex exactly once and returns to the starting
vertex .
Formally , given an undirected graph 𝐆 = (𝑽, 𝑬) where 𝑽 is the set of vertices and 𝑬 is the set of edges , the
Hamiltonian cycle problem seeks to find a cycle that visits every vertex in 𝑬 exactly once.
For example consider the following graph in Figure 5 ,
this graph contain a Hamiltonian cycle : 𝒂 → 𝒃 → 𝒆 → 𝒇 → 𝒅 → 𝒄 → 𝒂 .
It's a cycle that visits every vertex (𝒂 , 𝒃 , 𝒄 , 𝒅 , 𝒆 , 𝒇) exacltly once and
Returns to the starting vertex (𝒂) .

The Hamiltonian cycle problem is known to be NP-complete, meaning that


it is among the hardest problems in the complexity class NP . This implies
that there is no known polynomial-time algorithm that can solve all
instances of the problem. However, there are algorithms and techniques
that can be used to find Hamiltonian cycles in certain classes of graphs or
to approximate solutions for large graphs. Figure 5
3. Knapsack Problem :

The Knapsack Problem is a classic optimization problem in computer science and combinatorial optimization. It's
about determining the best way to fill a knapsack (a container) with a limited capacity, so as to maximize the total
value of the items placed in it.
Formaly , let consider a set of items , each with a weight 𝒘𝒊 and a value 𝒗𝒊 , and a knapsack with a maximum weight
capacity 𝑾 the goal is to select a subset of the items to include in the knapsack such that:
- The total weight of the selected items does not exceed the capacity of the knapsack : σ𝒊 𝒘𝒊 ≤ 𝑾
- The total value of the selected items is maximized : σ𝒊 𝒗𝒊

the Knapsack Problem is also an NP complete problem


The proof of its NP-completeness typically involves reduction from another
NP-complete problem, such as the subset sum problem or
the Boolean satisfiability problem (SAT).

Figure 6
Conclusion :
In conclusion, computational complexity theory serves as a cornerstone in computer science, providing a
systematic framework for understanding the inherent difficulty of computational problems. Through the
classification of problems into various complexity classes such as P and NP, we gain insights into the nature of
algorithms and their efficiency. NP-complete problems, including SAT, Hamiltonian cycle, Knapsack, and Graph
Coloring, stand out as particularly challenging puzzles in this landscape. These NP-complete problems possess a
remarkable property: while solutions can be efficiently verified, the search for solutions is conjectured to require
exponential time. Their pervasive presence across diverse domains underscores their significance in theoretical
and practical contexts alike. From optimization and cryptography to scheduling and logistics, NP-complete
problems arise in numerous real-world scenarios, driving research and innovation in algorithm design and
computational methods. Despite their computational hardness, NP-complete problems offer valuable insights into
the boundaries of computation and the limits of algorithmic efficiency. They challenge us to explore novel
approaches and heuristic techniques for tackling complex optimization problems. As we continue to delve deeper
into the mysteries of computational complexity, the quest for efficient algorithms and the exploration of the P vs.
NP question remain central pursuits, shaping the future of computer science and technology.

You might also like