Worked Examples: NP-Completeness

These examples are designed to step through the logical process of applying the algorithmic concepts.

Example 1: Class P
❓ Problem: Definition.
💡 Solution: Solvable in Poly-time.
Example 2: Class NP
❓ Problem: Definition.
💡 Solution: Verifiable in Poly-time (Nondeterministic Poly time).
Example 3: Reduction Direction
❓ Problem: If $A \le_p B$ and B in P?
💡 Solution: A is in P.
Example 4: Reduction Direction 2
❓ Problem: If $A \le_p B$ and A is Hard?
💡 Solution: B is Hard.
Example 5: SAT
❓ Problem: Input/Output?
💡 Solution: Boolean formula. Yes if assignment makes True.
Example 6: NP-Hard vs NPC
❓ Problem: Difference?
💡 Solution: NPC must be in NP. NP-Hard doesn't (Halting Problem).