Question

Explain P and NP class of problems. Explain P=NP? argument. What would happen if P=NP is...

Explain P and NP class of problems. Explain P=NP? argument. What would happen if P=NP is found to be true? Why do we classify problems into different complexity classes such as P, NP, NP-Complete, NP-Hard etc? Why it is so important to study these complexity classes?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Every decision problem can have only two answers, yes or no. Hence, a decision problem may belong to a language if it provides an answer ‘yes’ for a specific input. A language is the totality of inputs for which the answer is Yes. Most of the algorithms discussed in the previous chapters are polynomial time algorithms.

For input size n, if worst-case time complexity of an algorithm is O(nk), where k is a constant, the algorithm is a polynomial time algorithm.

Algorithms such as Matrix Chain Multiplication, Single Source Shortest Path, All Pair Shortest Path, Minimum Spanning Tree, etc. run in polynomial time. However there are many problems, such as traveling salesperson, optimal graph coloring, Hamiltonian cycles, finding the longest path in a graph, and satisfying a Boolean formula, for which no polynomial time algorithms is known. These problems belong to an interesting class of problems, called the NP-Complete problems, whose status is unknown.
P-Class
The class P consists of those problems that are solvable in polynomial time, i.e. these problems can be solved in time O(nk) in worst-case, where k is constant.

These problems are called tractable, while others are called intractable or superpolynomial.

Formally, an algorithm is polynomial time algorithm, if there exists a polynomial p(n) such that the algorithm can solve any instance of size n in a time O(p(n)).

Problem requiring Ω(n50) time to solve are essentially intractable for large n. Most known polynomial time algorithm run in time O(nk) for fairly low value of k.

The advantages in considering the class of polynomial-time algorithms is that all reasonable deterministic single processor model of computation can be simulated on each other with at most a polynomial slow-d

NP-Class
The class NP consists of those problems that are verifiable in polynomial time. NP is the class of decision problems for which it is easy to check the correctness of a claimed answer, with the aid of a little extra information. Hence, we aren’t asking for a way to find a solution, but only to verify that an alleged solution really is correct.

Every problem in this class can be solved in exponential time using exhaustive search.

P versus NP
Every decision problem that is solvable by a deterministic polynomial time algorithm is also solvable by a polynomial time non-deterministic algorithm.

The difference between P and NP problems

Adding two number is really easy. Surely, as the numbers get larger the computation becomes harder to us human. But to a computer adding large numbers are fairly simple. We can say computers can add two numbers in polynomial time. These types of problem which can be solved in polynomial time by a computer are known as P problems.

But what about a little complex problem like prime factorization? We know that every composite number can be expressed as a product of two or more prime factors. Our normal PCs can handle this problem within seconds for numbers up to a billion. But as the numbers grow this problem becomes lot harder even for the fastest of computers. So this is not solvable in Polynomial time.

But what if I give you the factors? Can you verify the solution? Like if I say, 35 can be factorized as 5*7. Can you verify it? You can easily multiply 5 and 7 real quick and find that it indeed produces 35. In fact, multiplication is a P problem. Computers can multiply fairly large numbers in no time. So factorization is not solvable in polynomial time but the solution is verifiable in polynomial time. These problems are known as NP problems.


All problems in P can be solved with polynomial time algorithms, whereas all problems in NP - P are intractable.

It is not known whether P = NP. However, many problems are known in NP with the property that if they belong to P, then it can be proved that P = NP.

If P ≠ NP, there are problems in NP that are neither in P nor in NP-Complete.

The problem belongs to class P if it’s easy to find a solution for the problem. The problem belongs to NP, if it’s easy to check a solution that may have been very tedious to find.


NP problems have their own significance in programming, but the discussion becomes quite hot when we deal with differences between NP, P , NP-Complete and NP-hard.

P and NP- Many of us know the difference between them.

P- Polynomial time solving . Problems which can be solved in polynomial time, which take time like O(n), O(n2), O(n3). Eg: finding maximum element in an array or to check whether a string is palindrome or not. so there are many problems which can be solved in polynomial time.

NP- Non deterministic Polynomial time solving. Problem which can't be solved in polynomial time like TSP( travelling salesman problem) or An easy example of this is subset sum: given a set of numbers, does there exist a subset whose sum is zero?.

but NP problems are checkable in polynomial time means that given a solution of a problem , we can check that whether the solution is correct or not in polynomial time.

So till now you have got what is NP and what is P.

Now we will discuss about NP-Complete and NP-hard.

but first we need to know what is reducibility .

Take two problems A and B both are NP problems.

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.

NP-hard-- Now suppose we found that A is reducible to B, then it means that B is at least as hard as A.

NP-Complete -- The group of problems which are both in NP and NP-hard are known as NP-Complete problem.

In computational complexity theory, a complexity class is a set of problems of related resource-based complexity. A typical complexity class has a definition of the form: the set of problems that can be solved by an abstract machine M using O(f(n)) of resource R, where n is the size of the input.
Now suppose we have a NP-Complete problem R and it is reducible to Q then Q is at least as hard as R and since R is an NP-hard problem. therefore Q will also be at least NP-hard , it may be NP-complete also.


All the classes you mention are classes of languages, formally, even if P and NP are often discussed in different terms. Note that terminology revolving around decision problems is equivalent to formal languages; the decision is always whether a word is in the given language, i.e. the problem is to solve the word problem.

What you need to do is go back to the formal definitions. Summarising:

RE contains languages which are accepted by any TM.
REC contains all languages which are decided by any TM.
NP contains all languages which are accepted by any polynomial-time TM.
P contains all languages which are decided by any polynomial-time and deterministic TM.
It's already quite clear from the definitions that we have

P⊆NP⊆REC⊆RE.

So, essentially, computability and complexity theory deal with the same kind of questions: which kinds of problems can I solve with which type of machine?

In fact, the famous Complexity Zoo diagram displays "computability", "complexity" and "Chomsky" classes in a single inclusion hierarchy -- because they all use the same formalism.


What would happen if someone proves P=NP or P!=NP

Actually, to add a word of caution to these answers saying that P = NP would mean public key encryption is insecure, and all famous problems with short proofs would be quickly proved - actually that doesn't follow at all.

Polynomial time doesn't tell you anything about the coefficients of the polynomial. What if the coefficients are all of the order of 10^(10^10) (1 followed by 10,000,000,000 zeros) or higher?

Even a solution in linear time would be of no practical use at all if the coefficient is huge.

To take an example, suppose someone found a solution of the traveling salesman problem which requires at most 10^(10^10) * n steps, where n is the number of cities?

That's a linear time solution, and if anyone found such a solution it would prove P = NP, (because it is an NP complete problem) - they'd be immediately famous - but it's not a practical solution.

It wouldn't be at all astonishing if it came up with really huge coefficients like that. Maybe even coefficients that need Knuth's up-arrow notation (similarly to Graham's number). Then it would still be a theoretically very interesting result, even if the coefficients are too large to be expressed with exponential notation.

Of course many mathematicians would then work away at the proof to try to reduce the size of the coefficients - but no a priori reason why they have to succeed in reducing them to the extent that it becomes practically useful.

Add a comment
Know the answer?
Add Answer to:
Explain P and NP class of problems. Explain P=NP? argument. What would happen if P=NP is...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT