P and NP Flashcards
Describe P class
Problems that belong to class P are those for which an algorithm can find a solution in polynomial time, specifically in
O(n^k) time, where
n is the input size and
k is a constant.
Describe the NP class
Problems for which a potential solution can be verified in polynomial time but not necessarily found in polynomial time.
Example: The Traveling Salesman Problem (TSP). Given a set of cities and the distances between them, finding the shortest possible route that visits each city exactly once and returns to the origin city is an NP problem.
Describe the NP Complete problem
NP-Complete problems are the hardest problems in NP for which no efficient solution has been found. If any one of them is solved efficiently, all problems in NP can be solved efficiently.
Describe the NP Hard Class.
Problems that are at least as hard as the hardest problems in NP but might not be in NP themselves.