Exercises — Approximation algorithms — approximation ratio, examples
Level 1 — Recognition
L1.1 — Read the guarantee
A minimization algorithm is proved to be a 2-approximation. On some input the true optimum is . What is the most your algorithm could possibly return on that input?
Recall Solution
WHAT we do: apply the definition directly (this is rung 2 of the LB-LADDER read off in reverse). WHY: for minimization the ratio bounds from above. So the answer is at most 60. Note it could be anything from (perfect) up to — the guarantee is only the ceiling.
L1.2 — Spot the wrong convention
For a maximization problem a student writes: "My algorithm is a -approximation, so ." Is the direction of the inequality correct?
Recall Solution
No. For maximization the ratio bounds from below: A max-algorithm that returned at most half of optimum would be useless — you want a guarantee that you get at least some fraction. The correct statement is .
L1.3 — Name the lower bound
In the Vertex Cover 2-approximation, we compare against which computable quantity to stand in for ?
Recall Solution
The size of the maximal matching we greedily built, i.e. . Every vertex cover needs vertex per disjoint matched edge, so (rung 2); and our algorithm outputs (rung 1).
Level 2 — Application
L2.1 — Vertex Cover on a path
Run the maximal-matching Vertex Cover algorithm on the path : vertices (edges ). What cover size do you get, what is , and what is the realised ratio?
Recall Solution
WHAT we do: greedily pick uncovered edges, add both endpoints, delete touching edges.
- Pick edge : add to . Delete edges touching or → deletes and .
- Remaining edge : add to . Delete it.
- , so .
OPT: the set covers all three edges ( via , via either, via ), so . Ratio realised: . This input is tight — it hits the worst case exactly.
L2.2 — Load balancing, small instance
Jobs of sizes on machines, greedy = "put each job on the currently least-loaded machine" (ties → machine 1). Compute the makespan and compare to the two lower bounds and .
Recall Solution
WHAT we do: place jobs one by one on the least loaded machine.
| Job | Loads before | Placed on | Loads after |
|---|---|---|---|
| 3 | (0,0) | M1 | (3,0) |
| 3 | (3,0) | M2 | (3,3) |
| 2 | (3,3) | M1 | (5,3) |
| 2 | (5,3) | M2 | (5,5) |
| 2 | (5,5) | M1 | (7,5) |
Makespan . WHY the 2-guarantee holds here (climbing the LB-LADDER): let be the last job placed on the busiest machine (). Just before it was added that machine was the least loaded, so every machine had load ; summing over all machines gives , i.e. . Now use the two lower bounds (rung 1 uses both, rung 2 says each is ): Numbers: average ; . So ; true ( on one machine, on the other). Realised ratio — well under the guaranteed 2, exactly as the ladder promises.
L2.3 — Metric TSP double-tree cost bound
An MST of a metric instance has . Using the double-tree algorithm, what is the guaranteed upper bound on the tour returned, and what does that tell you about ?
Recall Solution
WHY the 2-guarantee holds here (climbing the LB-LADDER): the lower bound is , the MST cost. Rung 1: the Euler walk of the doubled tree costs , and shortcutting repeated cities (triangle inequality) never increases cost, so . Rung 2: deleting one edge of any optimal tour leaves a spanning tree (see L3.2), and the MST is the cheapest tree, so . Chaining: Numbers: , so ; and gives . Combining: .
Level 3 — Analysis
L3.1 — Why the tight example is tight
Consider the complete bipartite graph (two sides of vertices, every left vertex joined to every right vertex). Show the maximal-matching Vertex Cover algorithm can output while , proving the analysis cannot be improved for this algorithm.
Recall Solution
WHY this graph: a perfect matching of size exists (pair left with right ), and the algorithm grabs both endpoints of each. The figure below shows the case — read it alongside this solution.
- ALG (blue-filled vertices in the figure): the algorithm can build a maximal matching of disjoint edges (the orange edges –). Each contributes 2 vertices → , .
- OPT (green rings in the figure): take just one side, say all left vertices. Every edge has a left endpoint, so it is covered. Hence . And because a maximal matching of size forces vertices. So .
- Ratio: .
This is a family of inputs (one per ) that forces the ratio to exactly 2, so no analysis of this algorithm can prove a constant below 2.
The figure below makes the two-vs-one competition literal. It is the complete bipartite graph : three left vertices and three right vertices , with every left vertex joined to every right vertex (thin gray edges). The three orange edges are the greedy matching (namely ). The blue-filled dots are the vertices the algorithm keeps — both endpoints of every orange edge, i.e. all six. The green rings surround the vertices an optimal cover needs (the entire left side ). So the picture shows blue=6 against green=3, i.e. ratio .

L3.2 — Removing an edge from a TSP tour
Prove carefully that deleting one edge from any Hamiltonian tour on vertices yields a spanning tree, and hence .
Recall Solution
WHAT a tour is: a cycle visiting all vertices, using edges. Delete one edge: we now have edges on vertices, still touching every vertex (each vertex had degree 2 in the cycle; the two endpoints of the removed edge drop to degree 1, the rest stay 2 — nobody is isolated). Why it's a tree: the remaining graph is a single path — connected (a cycle minus one edge stays connected) and acyclic (removing the one edge of the only cycle kills all cycles). A connected acyclic graph spanning all vertices is a spanning tree. Cost inequality: this spanning tree costs (it's part of the tour). The minimum spanning tree is any spanning tree, so
L3.3 — Two lower bounds are both necessary
In load balancing, show that using only the average bound fails when one job is huge, and only the bound fails when all jobs are tiny. Give a concrete instance for each.
Recall Solution
Only average, huge job fails: , jobs . Average , but a single job of size must go somewhere, so . The average bound is too weak; we need . Only max, tiny jobs fails: , jobs . , but four unit jobs on two machines force . Here the average bound is the tight one.
Conclusion: the greedy proof uses , and both pieces can individually be the binding constraint — neither alone suffices.
Level 4 — Synthesis
L4.1 — Design a bound for max-coverage-ish greedy
You have identical machines and jobs . Run Longest-Processing-Time-first (LPT): sort descending, greedily place each on the least-loaded machine. Compute the makespan, then verify it beats the general guarantee.
Recall Solution
WHAT LPT does: sort (already sorted), place biggest first.
| Job | Loads before | Placed | Loads after |
|---|---|---|---|
| 5 | (0,0,0) | M1 | (5,0,0) |
| 4 | (5,0,0) | M2 | (5,4,0) |
| 4 | (5,4,0) | M3 | (5,4,4) |
| 3 | (5,4,4) | M2 | (5,7,4) |
| 2 | (5,7,4) | M3 | (5,7,6) |
| 2 | (5,7,6) | M1 | (7,7,6) |
Makespan . WHY it beats (LB-LADDER): the same two lower bounds apply. The average is , so . Now the integer trick: every job size is an integer, so every machine load — a sum of integers — is an integer, hence is an integer; by the "round a lower bound UP" corner-case box above we may strengthen to . Also . The general greedy proof already guarantees . But LPT does far better: since and we achieved , here (realised by ) and the ratio is exactly — comfortably inside the ceiling.
L4.2 — Combine two algorithms
For Metric TSP you're told Christofides gives a -approximation. If an instance has , and you run both double-tree and Christofides and keep the better (cheaper) tour, what is the guaranteed upper bound on the tour you keep, and what approximation ratio does the combined procedure enjoy?
Recall Solution
WHAT we do: run two guaranteed algorithms and keep the minimum-cost output; the guarantee for the kept tour is the smaller of the two ceilings. WHY (LB-LADDER, applied to each algorithm then combined): each algorithm has already climbed its own ladder against the MST/tour lower bounds, giving us two upper bounds on its output:
- Double-tree: .
- Christofides: .
We keep . Since , the kept tour is guaranteed: Ratio: dividing by , , so the combined procedure is a . General principle: running an extra approximation alongside and keeping the best can only tighten the guarantee — the combined ratio is the minimum (best) of the individual ratios, never their product and never worse than either alone.
L4.3 — Build a fresh lower bound
For the minimum makespan problem with machine (one machine, jobs), what is , and what ratio does any greedy achieve? Explain via the lower bounds.
Recall Solution
With one machine, every job runs on it, so makespan for any ordering. Thus and the ratio is exactly . Via the LB-LADDER: the average bound already equals the answer, so and the ladder collapses to equality. Degenerate case: no approximation needed when .
Level 5 — Mastery
L5.1 — Prove a lower bound is tight for greedy load balancing
Construct a family of instances forcing the plain greedy (non-sorted) load balancer to ratio . Do it for : give an instance where greedy .
Recall Solution
Idea: flood with tiny jobs to balance the machines, then drop one big job. , jobs processed in this order.
- Job → M1: .
- Job → M2: .
- Job → M1 (tie, pick M1): .
Greedy makespan . OPT: put the alone, the two s together: loads , . Ratio . This matches the known tight bound for greedy list-scheduling on .
L5.2 — Inapproximability sanity check
Explain in your own words why the double-tree argument cannot be salvaged for general (non-metric) TSP, connecting to the inapproximability result.
Recall Solution
Where it breaks: the shortcutting step replaces by and claims — this is exactly the Triangle Inequality. Without it, can be astronomically larger than the detour, so shortcutting may inflate cost without bound. The whole "" line collapses. Deeper reason: general TSP admits no constant-factor approximation unless (a reduction from Hamiltonian Cycle plants a giant edge weight that any constant-factor algorithm would be forced to avoid, thereby solving Hamiltonicity). See Inapproximability / PCP theorem. So no clever fix can exist — the barrier is complexity-theoretic, not a missing trick.
L5.3 — Full synthesis
An algorithm for a minimization problem is shown to satisfy where and both and . State the resulting approximation ratio and justify each inequality in the ladder.
Recall Solution
WHAT we combine: two lower bounds, added — this is the LB-LADDER with two rung-2 pieces. Justification, term by term:
- : some machine gets at least the average load, so the optimum makespan is the average.
- : the biggest single job must run on some machine, so the optimum makespan is that job's size.
- Rung 1 is the hypothesis (proved directly about the algorithm); rung 2 replaces each of the two summands by .
Resulting ratio: , i.e. the algorithm is a 2-approximation. This is exactly the greedy load-balancing analysis of L2.2, generalised: whenever your algorithm's cost decomposes into a bounded number of pieces each , you get a -approximation for free.
Recall Master checklist
- L1: guarantee = deterministic cost ceiling, not a probability.
- L2: report the actual output, distinguish it from the bound; every guarantee is a climb of the LB-LADDER.
- L3: pick the right lower bound; sometimes you need two.
- L4: best-of-several takes the minimum guarantee; with integer objectives you may round a real lower bound up (L4.1).
- L5: tight examples validate the analysis; complexity barriers block impossible fixes.
- Corner case: ratios need non-negative objective values; forces , negative weights fall outside the framework.
Connections
- Parent: Approximation Ratio & Examples
- Vertex Cover · Maximum Matching — L1.3, L2.1, L3.1.
- Minimum Spanning Tree · Triangle Inequality — L2.3, L3.2, L5.2.
- Greedy Algorithms — load balancing L2.2, L4.1, L5.1.
- PTAS and FPTAS · Inapproximability / PCP theorem — L5.2.
- NP-completeness — why any of this is needed.