Get startedGet started for free

Computational complexity

1. Computational complexity

Previously, we discussed how to determine if a problem is computable using models of computation. Now, we’ll explore different types of problems and classify them by their complexity, a field known as computational complexity.

2. Complexity classes

To better understand computational complexity, let's explore four fundamental categories: Polynomial Time (P), Nondeterministic Polynomial Time (NP), NP-Complete, and NP-Hard. These categories help us classify problems based on how the time needed to solve them grows as the size of the input grows. In general, P is the easiest class of problems, and NP-Hard is the hardest. Let's explore each of these separately.

3. P (Polynomial Time)

P, or Polynomial Time problems are those that computers can solve efficiently. Even as data grows, the time increases at a manageable rate (like linearly or quadratically). Examples include sorting a list. In our office analogy, it's like "Filing documents alphabetically" — these problems are practical and computationally "easy" due to predictable, manageable growth.

4. NP (Non-deterministic Polynomial Time)

NP, or Nondeterministic Polynomial Time problems allow for quick verification of a solution but are time-consuming to solve from scratch. A Sudoku puzzle is a good example: verifying a completed grid is easy, but solving it is challenging. In our office analogy, it’s like locating a document with missing information — easy to verify once found, but hard to locate. The key point: verifying is easy; finding the solution is difficult with current methods.

5. NP-Complete

NP-Complete problems are the hardest in NP, meaning that solving any NP-Complete problem efficiently would make all NP problems solvable efficiently. An example is the traveling salesman problem, where finding the shortest route to visit multiple cities is challenging. In our office analogy, it’s like completing a large, complex jigsaw puzzle—easy to verify when finished but difficult to solve. The key point: no efficient solution exists yet, but finding one would solve all NP problems efficiently.

6. NP-Hard

NP-Hard problems are as challenging as NP-Complete or even more so, with solution verification often impractically slow. An example is optimal scheduling, where managing many tasks with complex dependencies makes even checking a schedule difficult. In our office analogy, it’s like scheduling meetings with numerous constraints, finding a solution is tough, and verifying one can be just as challenging. The key point: some NP-Hard problems may be practically unsolvable, potentially requiring more time than the age of the universe.

7. The big mystery of P=NP?

The question of whether P = NP? is a foundational research challenge in computer science with vast implications. In essence, it asks whether every problem whose solution can be quickly verified (an NP problem) can also be quickly solved (a P problem). Currently, NP problems are approached with statistical methods and approximations, which don’t always yield exact solutions. These problems impact fields like cryptography, machine learning, drug discovery, and logistics. Proving P = NP would mean we could compute exact solutions efficiently, eliminating the need for approximations. Imagine a world where we can create personalized drugs to cure unique diseases or train machine learning algorithms on all human knowledge simultaneously. The possibilities would be endless. Perhaps you might even be the one to solve it someday.

8. Let's practice!

We just learned how complex problems can get. Lets review the knowledge.

Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.