Nepedia
Back to Discover
Fluent Reader
🔢

NP (complexity)

math Maturity 11-13 Next article →

Computer science uses special groups to sort different kinds of puzzles. One very important group is called NP. NP stands for nondeterministic polynomial time. This name sounds very long and scary. But it actually describes a simple idea about how we check answers. In NP, a computer might struggle to find a solution. However, if someone gives you a proof, you can check it very quickly. This fast check is called a verifier. We say the problem is in NP if a verifier can confirm a "yes" answer in a short amount of time.

P np np-complete np-hard
P np np-complete np-hard

To understand how this works, imagine a math puzzle. Suppose you have a list of numbers like -7, -3, -2, 5, and 8. You want to know if any group of these numbers adds up to zero. Finding that group might take a long time because there are many combinations to try. But if a friend says, "Look at -3, -2, and 5," the job becomes easy. You just add those three numbers together. Since they do equal zero, you have quickly verified the answer is "yes." This specific puzzle is called the subset sum problem. It is a perfect example of an NP problem.

Complexity-classes-polynomial
Complexity-classes-polynomial

There is another group of problems called P. These are problems that a computer can solve quickly on its own. We call this "polynomial time," which means the work grows at a steady rate as the problem gets bigger. Every problem in P is also in NP. This is because if you can solve a puzzle quickly, you can also check the answer quickly. Scientists have a huge mystery about these two groups. They believe that P is smaller than NP. This would mean some puzzles are easy to check but very hard to solve. However, no one has been able to prove this yet.

Complexity subsets pspace
Complexity subsets pspace

Some problems in the NP group are much harder than others. We call these the NP-complete problems. They are like the leaders of the group. If you found a fast way to solve just one NP-complete problem, you could solve every single problem in NP. This would happen because all NP problems are linked to them. Because of this, many researchers look for these special problems. Finding a fast way to solve one would change everything in computer science.

P np np-complete np-hard
P np np-complete np-hard

There are even more groups to explore in this field. There is a group called co-NP. These are problems where it is easy to verify a "no" answer. For example, if you want to prove a number is not prime, you just show one factor. We also know that NP is part of a much larger group called PSPACE. This group includes problems that can be solved using a certain amount of computer memory. Even though these groups are complex, they help us understand how computers think.

Complexity subsets pspace
Complexity subsets pspace
473 words

Where will your curiosity go next?

Keep exploring at your chosen reading level.

🖼️ Images & Media (3)
File:P np np-complete np-hard.svg
P np np-complete np-hard.svg
File:Complexity subsets pspace.svg
Complexity subsets pspace.svg
File:Complexity-classes-polynomial.svg
Complexity-classes-polynomial.svg
More to explore

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.