0% found this document useful (0 votes)
19 views23 pages

Unit 5

Uploaded by

13 JAYALAKSHMI K
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)
19 views23 pages

Unit 5

Uploaded by

13 JAYALAKSHMI K
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/ 23

Unit 5

NP Hard and NP-Complete

NP Hard and NP-Complete:

A problem is in the class NPC if it is in NP and is as hard as any problem in NP. A


problem is NP-hard if all problems in NP are polynomial time reducible to it, even though it may
not be in NP itself.

NP-hard

If a polynomial time algorithm exists for any of these problems, all problems in NP would be
polynomial time solvable. These problems are called NP-complete. The phenomenon of NP-
completeness is important for both theoretical and practical reasons.

Definition of NP-Completeness

A language B is NP-complete if it satisfies two conditions

B is in NP

Every A in NP is polynomial time reducible to B.

If a language satisfies the second property, but not necessarily the first one, the language B is
known as NP-Hard. Informally, a search problem B is NP-Hard if there exists some NP-Complete
problem A that Turing reduces to B.
The problem in NP-Hard cannot be solved in polynomial time, until P = NP. If a problem is
proved to be NPC, there is no need to waste time on trying to find an efficient algorithm for it.
Instead, we can focus on design approximation algorithm.

NP-Complete Problems

Following are some NP-Complete problems, for which no polynomial time algorithm is known.

Determining whether a graph has a Hamiltonian cycle

Determining whether a Boolean formula is satisfiable, etc.

NP-Hard Problems

The following problems are NP-Hard

The circuit-satisfiability problem

Set Cover

Vertex Cover

Travelling Salesman Problem

In this context, now we will discuss TSP is NP-Complete

TSP is NP-Complete

The traveling salesman problem consists of a salesman and a set of cities. The salesman has to
visit each one of the cities starting from a certain one and returning to the same city. The
challenge of the problem is that the traveling salesman wants to minimize the total length of
the trip

Proof
To prove TSP is NP-Complete, first we have to prove that TSP belongs to NP. In TSP, we find a
tour and check that the tour contains each vertex once. Then the total cost of the edges of the
tour is calculated. Finally, we check if the cost is minimum. This can be completed in polynomial
time. Thus TSP belongs to NP.

Secondly, we have to prove that TSP is NP-hard. To prove this, one way is to show that
Hamiltonian cycle ≤p TSP (as we know that the Hamiltonian cycle problem is NPcomplete).

Assume G = (V, E) to be an instance of Hamiltonian cycle.

Hence, an instance of TSP is constructed. We create the complete graph G' = (V, E'), where

E′={(i,j):i,j∈Vandi≠j

Thus, the cost function is defined as follows −

t(i,j)={01if(i,j)∈Eotherwise

Now, suppose that a Hamiltonian cycle h exists in G. It is clear that the cost of each edge in h is
0 in G' as each edge belongs to E. Therefore, h has a cost of 0 in G'. Thus, if graph G has a
Hamiltonian cycle, then graph G' has a tour of 0 cost.

Conversely, we assume that G' has a tour h' of cost at most 0. The cost of edges in E' are 0 and 1
by definition. Hence, each edge must have a cost of 0 as the cost of h' is 0. We therefore
conclude that h' contains only edges in E.

We have thus proven that G has a Hamiltonian cycle, if and only if G' has a tour of cost at most
0. TSP is NP-complete.
Polynomial Time:
What do you mean by polynomial time?

(definition) Definition: When the execution time of a computation, m(n), is no more than a
polynomial function of the problem size, n. More formally m(n) = O(n k) where k is a constant.

Polynomial-Time Algorithms

A polynomial-time algorithm is an algorithm whose execution time is either given by a


polynomial on the size of the input, or can be bounded by such a polynomial. Problems that can
be solved by a polynomial-time algorithm are called tractable problems.

For example, most algorithms on arrays can use the array size, n, as the input size. To find the
largest element in an array requires a single pass through the array, so the algorithm for doing
this is O(n), or linear time.

Sorting algorithms usually require either O(n log n) or O(n2) time. Bubble sort takes linear time
in the best case, but O(n2) time in the average and worst cases. Heapsort takes O(n log n) time in
all cases. Quicksort takes O(n log n) time on average, but O(n2) time in the worst case.

Regarding O(n log n) time, note that

 The base of the logarithms is irrelevant, since the difference is a constant factor, which
we ignore; and
 Although n log n is not, strictly speaking, a polynomial, the size of n log n is bounded by
n2, which is a polynomial.

Probably all the programming tasks you are familiar with have polynomial-time solutions. This
is not because all practical problems have polynomial-time solutions. Rather, it is because your
courses and your day-to-day work have avoided problems for which there is no known practical
solution.

NP-Completeness:
We have been writing about efficient algorithms to solve complex problems, like shortest
path, Euler graph, minimum spanning tree, etc. Those were all success stories of
algorithm designers. In this post, failure stories of computer science are discussed.
Can all computational problems be solved by a computer? There are computational
problems that can not be solved by algorithms even with unlimited time. For example
Turing Halting problem (Given a program and an input, whether the program will
eventually halt when run with that input, or will run forever). Alan Turing proved that a
general algorithm to solve the halting problem for all possible program-input pairs cannot
exist. A key part of the proof is, Turing machine was used as a mathematical definition of
a computer and program (Halting Problem).
Status of NP Complete problems is another failure story, NP complete problems are
problems whose status is unknown. No polynomial time algorithm has yet been
discovered for any NP complete problem, nor has anybody yet been able to prove that no
polynomial-time algorithm exists for any of them. The interesting part is, if any one of
the NP complete problems can be solved in polynomial time, then all of them can be
solved.

What are NP, P, NP-complete and NP-Hard problems?


P is a set of problems that can be solved by a deterministic Turing machine in Polynomial
time.
NP is set of decision problems that can be solved by a Non-deterministic Turing Machine
in Polynomial time. P is subset of NP (any problem that can be solved by a deterministic
machine in polynomial time can also be solved by a non-deterministic machine in
polynomial time).
Informally, NP is a set of decision problems that can be solved by a polynomial-time via
a “Lucky Algorithm”, a magical algorithm that always makes a right guess among the
given set of choices.
NP-complete problems are the hardest problems in the NP set. A decision problem L is
NP-complete if:
1) L is in NP (Any given solution for NP-complete problems can be verified quickly, but
there is no efficient known solution).
2) Every problem in NP is reducible to L in polynomial time (Reduction is defined
below).
A problem is NP-Hard if it follows property 2 mentioned above, doesn’t need to follow
property 1. Therefore, the NP-Complete set is also a subset of the NP-Hard set.
Decision vs Optimization Problems
NP-completeness applies to the realm of decision problems. It was set up this way
because it’s easier to compare the difficulty of decision problems than that of
optimization problems. In reality, though, being able to solve a decision problem in
polynomial time will often permit us to solve the corresponding optimization problem in
polynomial time (using a polynomial number of calls to the decision problem). So,
discussing the difficulty of decision problems is often really equivalent to discussing the
difficulty of optimization problems.
For example, consider the vertex cover problem (Given a graph, find out the minimum
sized vertex set that covers all edges). It is an optimization problem. Corresponding
decision problem is, given undirected graph G and k, is there a vertex cover of size k?
What is Reduction?
Let L1 and L2 be two decision problems. Suppose algorithm A2 solves L2. That is, if y is
an input for L2 then algorithm A2 will answer Yes or No depending upon whether y
belongs to L2 or not.
The idea is to find a transformation from L1 to L2 so that algorithm A2 can be part of an
algorithm A1 to solve L1.
Learning reduction, in general, is very important. For example, if we have library
functions to solve certain problems and if we can reduce a new problem to one of the
solved problems, we save a lot of time. Consider the example of a problem where we
have to find the minimum product path in a given directed graph where the product of
path is the multiplication of weights of edges along the path. If we have code for
Dijkstra’s algorithm to find the shortest path, we can take the log of all weights and use
Dijkstra’s algorithm to find the minimum product path rather than writing a fresh code
for this new problem.
How to prove that a given problem is NP complete?
From the definition of NP-complete, it appears impossible to prove that a problem L is
NP-Complete. By definition, it requires us to that show every problem in NP in
polynomial time reducible to L. Fortunately, there is an alternate way to prove it. The
idea is to take a known NP-Complete problem and reduce it to L. If polynomial time
reduction is possible, we can prove that L is NP-Complete by transitivity of reduction (If
a NP-Complete problem is reducible to L in polynomial time, then all problems are
reducible to L in polynomial time).
What was the first problem proved as NP-Complete?
There must be some first NP-Complete problem proved by definition of NP-Complete
problems. SAT (Boolean satisfiability problem) is the first NP-Complete problem proved
by Cook (See CLRS book for proof).
It is always useful to know about NP-Completeness even for engineers. Suppose you are
asked to write an efficient algorithm to solve an extremely important problem for your
company. After a lot of thinking, you can only come up exponential time approach which
is impractical. If you don’t know about NP-Completeness, you can only say that I could
not come with an efficient algorithm. If you know about NP-Completeness and prove that
the problem is NP-complete, you can proudly say that the polynomial time solution is
unlikely to exist. If there is a polynomial time solution possible, then that solution solves
a big problem of computer science many scientists have been trying for years.

NP-Completeness Proofs:

How to Prove That a Problem Is NP-Complete?


NP-Complete Problems:
What are NP-complete problems give example?

NP-complete problem, any of a class of computational problems for which no efficient


solution algorithm has been found. Many significant computer-science problems belong to
this class—e.g., the traveling salesman problem, satisfiability problems, and graph-covering
problems.

So-called easy, or tractable, problems can be solved by


computer algorithms that run in polynomial time; i.e., for a problem of size n,
the time or number of steps needed to find the solution is
a polynomial function of n. Algorithms for solving hard, or intractable,
problems, on the other hand, require times that are exponential functions of
the problem size n. Polynomial-time algorithms are considered to be efficient,
while exponential-time algorithms are considered inefficient, because the
execution times of the latter grow much more rapidly as the problem size
increases.

A problem is called NP (nondeterministic polynomial) if its solution can


be guessed and verified in polynomial time; nondeterministic means that no
particular rule is followed to make the guess. If a problem is NP and all other
NP problems are polynomial-time reducible to it, the problem is NP-complete.
Thus, finding an efficient algorithm for any NP-complete problem implies that
an efficient algorithm can be found for all such problems, since any problem
belonging to this class can be recast into any other member of the class. It is
not known whether any polynomial-time algorithms will ever be found for NP-
complete problems, and determining whether these problems are tractable or
intractable remains one of the most important questions in
theoretical computer science. When an NP-complete problem must be solved,
one approach is to use a polynomial algorithm to approximate the solution;
the answer thus obtained will not necessarily be optimal but will be reasonably
close.
Part – A
1. What are the properties of NP-Complete Problem? [JAN 2022]
NP-complete problems are the hardest problems in the NP set. A decision problem L is NP-complete if:
1) L is in NP (Any given solution for NP-complete problems can be verified quickly, but there is no efficient
known solution).
2) Every problem in NP is reducible to L in polynomial time (Reduction is defined below).
2. How do you know if a person is NP-Hard? Or when is a Problem NP-Hard or NP-Complete?
A problem is NP-hard if all problems in NP are polynomial time reducible to it, even though it may not be
in NP itself. If a polynomial time algorithm exists for any of these problems, all problems in NP would be
polynomial time solvable. These problems are called NP-complete.
3. What does it mean for a problem to be NP-hard? [JAN2022]
A problem is NP-hard if an algorithm for solving it can be translated into one for solving any NP-problem
(nondeterministic polynomial time) problem. NP-hard therefore means “at least as hard as any NP-
problem,” although it might, in fact, be harder.
4. What are the properties of NP complete problem writing any properties?
L is in NP (Any given solution for NP-complete problems can be verified quickly, but there is no efficient
known solution).
Every problem in NP is reducible to L in polynomial time
5. How do you prove NP?
In order to prove that a problem L is NP-complete, we need to do the following steps: Prove your problem
L belongs to NP (that is that given a solution you can verify it in polynomial time) Select a known NP-
complete problem L' Describe an algorithm f that transforms L' into L
6. What is NP completeness problem in DAA?
NP-complete problem, any of a class of computational problems for which no efficient solution algorithm
has been found. Many significant computer-science problems belong to this class—e.g., the traveling
salesman problem, satisfiability problems, and graph-covering problems. Hamiltonian circuit, bin packing,
partition problems are NP complete problems.
7. Is TSP NP-complete?

The Euclidean travelling salesman problem is NP-complete.


The Travelling Salesman Problem is shown to be NP-Complete even if its instances are restricted
to be realizable by sets of points on the Euclidean plane.
In fact, TSP belongs to the class of combinatorial optimization problems known as NP-complete.
This means that TSP is classified as NP-hard because it has no “quick” solution and the
complexity of calculating the best route will increase when you add more destinations to the
problem
8. Is 3 SAT NP-complete?
The satisfiability problem (SAT) is to determine whether a given boolean expression is satisfiable. 3-SAT
is NP-Complete because SAT is – any SAT formula can be rewritten as a conjunctive statement of literal
clauses with 3 literals, and the satisifiability of the new statement will be identical to that of the original
formula.
3-SAT is one of Karp’s 21 NP-complete problems, and it is used as a starting point for proving that other
problems are also NP-hard. This is done by polynomial-time reduction from 3-SAT to the other problem.
9. Is 2 SAT NP-complete?
2-SAT (2-satisfiability) is a restriction of the SAT problem, in 2-SAT every clause has exactly two literals.
SAT is NP-complete, there is no known efficient solution known for it. However 2SAT can be solved
efficiently in $O(n + m)$ where $n$ is the number of variables and $m$ is the number of clauses
10. Why is knapsack NP-hard?
Knapsack is NP-hard through a reduction from the partition problem (see 10.5). Using dynamic
programming, we can get an exact solution for knapsack in time O(poly(n, Pmax)× log (nB)).
Unfortunately, this is not polynomial in the size of its representation – Pmax is actu- ally log Pmax in the
problem representation.
11. What is approximation algorithm in DAA?
An Approximate Algorithm is a way of approach NP-COMPLETENESS for the optimization problem.
This technique does not guarantee the best solution. The goal of an approximation algorithm is to come as
close as possible to the optimum value in a reasonable amount of time which is at the most polynomial
time.
12. What is Reducibility in DAA?
Reducibility- If we can convert one instance of a problem A into problem B (NP problem) then it means
that A is reducible to B.
Able to be made simpler, or smaller in size, amount, degree, importance, etc.
13. Why is subset sun NP-complete?
The number of additions is at most n-1. So the addition and comparision can be done in polynomial time.
Hence, SUBSET-SUM is in NP
This can be done by checking that the sum of the integers in subset S’ is equal to K. Subset Sum is NP-
Hard: In order to prove Subset Sum is NP-Hard, perform a reduction from a known NP-Hard problem to
this problem. Carry out a reduction from which the Vertex Cover Problem can be reduced to the Subset
Sum problem
14. Define NP class Problem? [JAN2022]
NP-complete problem, any of a class of computational problems for which no efficient solution algorithm
has been found. Many significant computer-science problems belong to this class—e.g., the traveling
salesman problem, satisfiability problems, and graph-covering problems.
15. What is P class Problem?
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
Class P is a class of all decision problems that can be solved in polynomial time by deterministic algorithms.
Deterministic algorithms are the algorithms that do not guess at a solution.
16. What is Polynomial time? Give example.
A polynomial-time algorithm is one which runs in an amount of time proportional to some polynomial
value of N, where N is some characteristic of the set over which the algorithm runs, usually its size.

For example, simple sort algorithms run approximately in time kN^2/2, where N is the number of
elements being sorted, and k is a proportionality constant that is CPU-dependent and specific to
this problem. Multiplication of NxN matrices runs approximately in time kN^3, where we are
talking about a different k for this different problem. If you want to get picky, there are other terms
in that polynomial, but they don’t matter as much as the n^3 term.
17. Define Non-Polynomial time or exponential time.
Non-deterministic polynomial time (NP) is actually a marker used to point to a set of problems and bounds
of the capability of certain types of computing. NP refers to the set of problems that can be solved in
polynomial time by a non-deterministic Turing machine
18. What is Decision Based Problem? Give example.
Decision problem is a computational problem that can be posed as a yes–no question of the input values.
An example of a decision problem is deciding by means of an algorithm whether a given natural number is
prime. Another is the problem “given two numbers x and y, does x evenly divide y?” The answer is either
‘yes’ or ‘no’ depending upon the values of x and y. A method for solving a decision problem, given in the
form of an algorithm, is called a decision procedure for that problem
19. Define NP-hard class: -
In computational complexity theory, NP-hardness (non-deterministic polynomial-time hardness) is the
defining property of a class of problems that are informally "at least as hard as the hardest problems in NP".
A simple example of an NP-hard problem is the subset sum problem.
20. Define NP-complete class: -
In computational complexity theory, a problem is NP-complete when: it is a problem for which the
correctness of each solution can be verified quickly (namely, in polynomial time) and a brute-force search
algorithm can find a solution by trying all possible solutions.
21. Define optimization problem. Give example.
An optimization problem consists to find the best solution among all possible ones. For example, in the Bin
Packing Problem (BPP) the aim is to find the right number of boxes of a given size to store a set of objects
of given sizes; optimization involves, for example, finding the smallest number of boxes.
22. What is 2CNF SAT?
The “2” in this name stands for the number of literals per clause, and “CNF” stands for conjunctive normal
form, a type of Boolean expression in the form of a conjunction of disjunctions.
Each clause in a 2-CNF formula is logically equivalent to an implication from one variable or negated
variable to the other.
Part – B
1. How will you prove that the problem is NP-Complete? Explain in detail.
NP-complete problem, any of a class of computational problems for which no efficient solution algorithm
has been found. Many significant computer-science problems belong to this class—e.g., the traveling
salesman problem, satisfiability problems, and graph-covering problems. Hamiltonian circuit, bin packing,
partition problems are NP complete problems.
There must be some first NP-Complete problem proved by the definition of NP-Complete problems. SAT
(Boolean satisfiability problem) is the first NP-Complete problem proved by Cook (See CLRS book for
proof).
It is always useful to know about NP-Completeness even for engineers. Suppose you are asked to write an
efficient algorithm to solve an extremely important problem for your company. After a lot of thinking, you
can only come up exponential time approach which is impractical. If you don’t know about NP-
Completeness, you can only say that I could not come up with an efficient algorithm. If you know about
NP-Completeness and prove that the problem is NP-complete, you can proudly say that the polynomial-
time solution is unlikely to exist. If there is a polynomial-time solution possible, then that solution solves a
big problem of computer science many scientists have been trying for years.

NP-complete problems are the hardest problems in the NP set. A decision problem L is NP-
complete if:
1) L is in NP (Any given solution for NP-complete problems can be verified quickly, but there is
no efficient known solution).
2) Every problem in NP is reducible to L in polynomial time (Reduction is defined below).
A problem is NP-Hard if it follows property 2 mentioned above, and doesn’t need to follow
property 1. Therefore, the NP-Complete set is also a subset of the NP-Hard set.
From the definition of NP-complete, it appears impossible to prove that a problem L is NP-
Complete. By definition, it requires us to that show every problem in NP is polynomial time
reducible to L. Fortunately, there is an alternate way to prove it. The idea is to take a known
NP-Complete problem and reduce it to L. If a polynomial-time reduction is possible, we can prove
that L is NP-Complete by transitivity of reduction (If an NP-Complete problem is reducible to L
in polynomial time, then all problems are reducible to L in polynomial time).
2. Discuss about any NP completeness problem with example.[JAN2022] (refer notes)
NP-complete problem, any of a class of computational problems for which no efficient
solution algorithm has been found. Many significant computer-science problems belong to this class—e.g.,
the traveling salesman problem, satisfiability problems, and graph-covering problems.
Traveling salesman problem, an optimization problem in graph theory in which the nodes (cities) of a graph
are connected by directed edges (routes), where the weight of an edge indicates the distance between two
cities. The problem is to find a path that visits each city once, returns to the starting city, and minimizes the
distance traveled. The only known general solution algorithm that guarantees the shortest path requires a
solution time that grows exponentially with the problem size (i.e., the number of cities). This is an example
of an NP-complete problem (from nonpolynomial), for which no known efficient (i.e., polynomial
time) algorithm exists.
Part – C

1. What are NP, P, NP-complete and NP-Hard problems? Explain in detail.[JAN2022]


To explain {P}, {NP}, and others, let’s use the same mindset that we use to classify problems in real life.
While we could use a wide range of terms to classify problems, in most cases we use an “Easy-to-Hard”
scale.
Now, in theoretical computer science, the classification and complexity of common problem definitions
have two major sets; {P} which is “Polynomial” time and \{NP} which “Non-deterministic Polynomial”
time. There are also NP-Hard and NP-Complete sets, which we use to express more sophisticated problems.
In the case of rating from easy to hard, we might label these as “easy”, “medium”, “hard”, and finally
“hardest”:
Easy -P

Medium -NP

Hard -NP Complete

Hardest -NP Hard


And we can visualize their relationship, too:

Using the diagram, we assume that {P} and {NP} are not the same set, or, in other words, we assume that
{P} not equal to {NP}. This is our apparently-true, but yet-unproven assertion. Of course, another
interesting aspect of this diagram is that we’ve got some overlap between \mathcal{NP} and
\mathcal{NP}\text{-}Hard. We call NP-Complete when the problem belongs to both of these sets.
Alright, so, we’ve mapped {P}, {NP}, NP Complete and NP-Hard to “easy”, “medium”, “hard” and
“hardest”.
Polynomial Algorithms
The first set of problems are polynomial algorithms that we can solve in polynomial time, like logarithmic,
linear or quadratic time. If an algorithm is polynomial, we can formally define its time complexity as:
T(n) = O(C * n^{k}) where C > 0 and k > 0 where C and k are constants and n is input size. In general, for
polynomial-time algorithms \textbf{\textit{k}} is expected to be less than \textbf{\textit{n}}. Many
algorithms complete in polynomial time:
 All basic mathematical operations; addition, subtraction, division, multiplication
 Testing for primacy (Priority)
 Hashtable lookup, string operations, sorting problems
 Shortest Path Algorithms; Djikstra, Bellman-Ford, Floyd-Warshall
 Linear and Binary Search Algorithms for a given set of numbers
NP Algorithms
The second set of problems cannot be solved in polynomial time. However, they can be verified (or
certified) in polynomial time. We expect these algorithms to have an exponential complexity, which we’ll
define as: T(n) = O(C_1 * k^{C_2 * n}) where C_1 > 0, C_2 > 0 and k > 0 where C_1, C_2 and k are
constants and n is the input size. T(n) is a function of exponential-time when at least C_1=1 and C_2=1. As
a result, we get O(k^n). For example, we’ll see complexities like O(n^n), O(2^n), O(2^{0.000001*n}) in
this set of problems. There are several algorithms that fit this description. Among them are:

 Integer Factorization and


 Graph Isomorphism
Both of these have two important characteristics: Their complexity is O(k^n) for some k and their results
can be verified in polynomial time. Those two facts place them all in NP, that is, the set of “Non-
deterministic Polynomial” algorithms. Now, formally, we also state that these problems must be decision
problems – have a yes or no answer – though note that practically speaking, all function problems can be
transformed into decision problems. This distinction helps us to nail down what we mean by “verified”.
To speak precisely, then, an algorithm is in {NP} if it can’t be solved in polynomial time and the set of
solutions to any decision problem can be verified in polynomial time by a “Deterministic Turing Machine“.
What makes Integer Factorization and Graph Isomorphism interesting is that while we believe they are in
NP, there’s no proof of whether they are in {P} and NPComplete. Normally, all NP-Complete algorithms
are in {NP}, but they have another property that makes them more complex compared to {NP} problems.
NP-Complete Algorithms
The next set is very similar to the previous set. Taking a look at the diagram, all of these all belong to NP,
but are among the hardest in the set. Right now, there are more than 3000 of these problems, and the
theoretical computer science community populates the list quickly. What makes them different from other
NP problems is a useful distinction called completeness. For any NP problem that’s complete, there exists
a polynomial-time algorithm that can transform the problem into any other NP-complete problem. This
transformation requirement is also called reduction.
As stated already, there are numerous NP problems proven to be complete. Among them are:

 Traveling Salesman
 Knapsack, and
 Graph Coloring
Curiously, what they have in common, aside from being in NP, is that each can be reduced into the other
in polynomial time. These facts together place them in NP-Complete. The major and primary work of NP-
Completeness belongs to Karp. And his 21, NP-Complete problems are fundamental to this theoretical
computer science topics. These works are founded on the Cook-Levin theorem and prove that the
Satisfiability (SAT) problem is NP-Complete:
NP-Hard Algorithms
Our last set of problems contains the hardest, most complex problems in computer science. They are not
only hard to solve but are hard to verify as well. In fact, some of these problems aren’t even decidable.
Among the hardest computer science problems are:

 K-means Clustering
 Traveling Salesman Problem, and
 Graph Coloring
These algorithms have a property similar to ones in NP-Complete – they can all be reduced to any problem
in NP. Because of that, these are in NP-Hard and are at least as hard as any other problem in {NP}. A
problem can be both in NP and NP-Hard, which is another aspect of being NP-Complete.
This characteristic has led to a debate about whether or not Traveling Salesman is indeed NP-Complete.
Since {NP} and NP-Complete problems can be verified in polynomial time, proving that an algorithm
cannot be verified in polynomial time is also sufficient for placing the algorithm in NP-Hard.

You might also like