Coursify

Design and Analysis of Algorithms (DAA)

PYQ Analysis & Exam Preparation — Module 4

30 mins

A strategic analysis of 8 exam questions spanning 2022–2024. Module 4 is the most theoretical module, focusing entirely on computational complexity classes and polynomial-time reductions.

Learning Goals

  • Identify the guaranteed theory question: Defining P, NP, NP-Complete, and NP-Hard with their relationship diagram.
  • Understand Cook's Theorem and its foundational importance in complexity theory.
  • Master the logic of polynomial-time reductions and practice the 3-SAT to Vertex Cover reduction.

The Exam Blueprint: Module 4 PYQ Deep Analysis (2022–2024)

An analysis of 8 exam questions spanning 2022 to 2024 reveals that Module 4 is short but incredibly predictable. It has the tightest scope of any module. The question asking to define P, NP, NP-Complete, and NP-Hard has appeared in every single paper.

Complete PYQ Table (8 Questions)

YearQ#MarksTopicType
2022Q1e2All NP-complete problems are NP-hardMCQ
2022Q1i2Polynomial-time reduction propertiesMCQ
2023Q1j2P is a subset of NPMCQ
2024Q1i2Primary technique to prove NP-completeMCQ
2022Q7b7Define P, NP, NP-complete, NP-hard + RelationTheory
2023Q7b7Define P, NP, NP-complete, NP-hard + RelationTheory
2024Q8a7Complexity classes + Cook's TheoremTheory
2024Q8b7Polynomial-time reduction + 3-SAT to Vertex CoverTheory

Total marks tracked: 38 marks across 3 years.


Topic Heat Map

Topic202220232024Total Marks
Complexity Classes Definitions & Relations7M ✅7M ✅7M ✅21M
Cook's Theorem & Reductions2M ✅14M ✅16M
MCQs4M ✅2M ✅2M ✅8M

(Note: Some topics overlap with MCQs).


The 2 Guaranteed Question Types

1. 🔴 The "Big Four" Complexity Classes (7M) Appeared in ALL 3 years. You must formally define P, NP, NP-Complete, and NP-Hard, and draw the standard Euler diagram showing their assumed relationship (assuming PNPP \neq NP).

2. 🟠 Reductions and Cook's Theorem (7M) Started appearing heavily in 2024. You must be able to state Cook's Theorem ("SAT is NP-Complete") and explain the mechanism of polynomial-time reductions.

The Critical Proofs & Reductions


Concept 1: Cook's Theorem

Statement: The Boolean Satisfiability Problem (SAT) is NP-Complete.

Why is it foundational? Before Cook's Theorem (proven by Stephen Cook in 1971), to prove a problem was NP-Complete, one would theoretically have to prove that every single problem in NP could be reduced to it. Cook proved that any non-deterministic Turing machine computation can be encoded as a Boolean formula. By proving that SAT is NP-Complete, Cook provided the first NP-Complete problem. From then on, to prove a new problem XX is NP-Complete, we only need to reduce SAT (or another known NP-Complete problem) to XX. It kickstarted the entire field of computational complexity.


Concept 2: The Logic of Polynomial-Time Reductions

What is it? A polynomial-time reduction from Problem A to Problem B (written as ApBA \le_p B) is an algorithm that transforms any instance of A into an instance of B in polynomial time, such that the answer to A is "YES" if and only if the answer to B is "YES".

How is it used to prove NP-Completeness? To prove that a new problem YY is NP-Complete:

  1. Prove that YNPY \in NP (a given solution can be verified in polynomial time).
  2. Choose a known NP-Complete problem XX.
  3. Prove that XpYX \le_p Y (reduce XX to YY in polynomial time). Because XX is NP-Complete, all problems in NP reduce to XX. If XX reduces to YY, by transitivity, all problems in NP reduce to YY, making YY NP-Hard. Since YNPY \in NP and YY is NP-Hard, YY is NP-Complete.

Trace: Reducing 3-SAT to Vertex Cover

To reduce a 3-SAT formula ϕ\phi to a Vertex Cover graph GG:

  1. Variables: For each variable xix_i, create two connected vertices: xix_i and ¬xi\neg x_i. (This forces the vertex cover to pick exactly one truth value).
  2. Clauses: For each clause (e.g., x1¬x2x3x_1 \lor \neg x_2 \lor x_3), create a triangle of 3 connected vertices. (This forces the vertex cover to pick at least two of these vertices).
  3. Connections: Connect the vertices in the clause triangles to their corresponding variable vertices in the variable gadgets.
  4. Conclusion: ϕ\phi is satisfiable if and only if GG has a vertex cover of size V+2CV + 2C (where VV is the number of variables and CC is the number of clauses). Since building this graph takes polynomial time, 3-SAT p\le_p Vertex Cover.

Knowledge Check

Question 1 of 4
Q1Single choice

Which one is true of the following?

High-Yield Subjective Bank: Structure Your Answers


####Define P, NP, NP-Complete, and NP-Hard. What is the relation between them? (7 Marks)**

Answer structure:

  1. P Class (Polynomial Time) (1.5M):

    • The set of decision problems that can be solved by a deterministic Turing machine in polynomial time O(nk)O(n^k).
    • These are considered "tractable" or easy problems.
    • Examples: Sorting, Shortest Path, MST.
  2. NP Class (Non-deterministic Polynomial Time) (1.5M):

    • The set of decision problems whose proposed solutions can be verified by a deterministic Turing machine in polynomial time.
    • Alternatively, problems that can be solved by a non-deterministic Turing machine in polynomial time.
    • Note: P is a subset of NP.
  3. NP-Hard Class (1.5M):

    • A problem XX is NP-Hard if every problem YNPY \in NP can be reduced to XX in polynomial time (YpXY \le_p X).
    • These are at least as hard as the hardest problems in NP. They do not have to be in NP themselves (e.g., they might not be decision problems).
    • Example: Halting Problem, TSP Optimization.
  4. NP-Complete Class (NPC) (1.5M):

    • A problem is NP-Complete if it satisfies two conditions:
      1. It is in NP.
      2. It is NP-Hard.
    • These are the hardest problems inside NP. If any NP-Complete problem is solved in polynomial time, then P=NPP = NP.
    • Examples: 3-SAT, Vertex Cover, Graph Coloring.
  5. Relationship (Euler Diagram) (1M):

    • Draw the standard diagram showing the relationship assuming PNPP \neq NP:
      • A large circle for NP.
      • Inside NP, a smaller circle for P at the bottom.
      • Another circle for NP-Complete at the top of NP, intersecting the boundary.
      • A region outside NP extending upwards representing NP-Hard, where the intersection of NP and NP-Hard forms the NP-Complete region.