3. Complexity and mathP vs NP
P vs NP
P vs NP is the biggest open question in computer science: if a solution is easy to check, is it also easy to find? P is the set of problems a computer can solve in polynomial time, meaning the effort grows manageably with input size. NP is the set where a proposed answer can be verified quickly, like a filled-in Sudoku or a route claimed to be under some length. Nobody has proved whether every NP problem also has a fast solution. The hardest ones, called NP-complete, are linked so that a fast method for one would solve them all. Spotting one tells you to stop hunting for a perfect fast algorithm and reach for heuristics, approximations or small-input tricks.
In this lesson: A TSP sim: brute force explodes past ~12 cities while nearest-neighbor plus 2-opt stays fast.