In classical algorithms, the entire input is known upfront:
The Offline Ideal
The Real-World Online Reality
How do we fairly evaluate an algorithm operating under partial information?
Sleator & Tarjan’s Framework (1985)
Benchmark the online algorithm \text{ALG} directly against an omniscient offline optimal algorithm \text{OPT} that knows the entire future sequence \sigma in advance!
Definition (c-Competitive for Minimization Problems): An online algorithm \text{ALG} is c-competitive if for all input sequences \sigma: \text{cost}(\text{ALG}(\sigma)) \le c \cdot \text{cost}(\text{OPT}(\sigma)) + \alpha where \alpha is a constant independent of \sigma.
The Competitive Ratio: c = \sup_{\sigma} \frac{\text{cost}(\text{ALG}(\sigma))}{\text{cost}(\text{OPT}(\sigma))}
The closer c is to 1, the better the online algorithm performs against omniscience.
Competitive analysis is viewed as a game played against a malicious Adversary:
The Two Players
Adversary Models for Randomized \text{ALG}
You go on a ski vacation of unknown duration k days (could break a leg tomorrow!):
Cost Structure
If \text{OPT} knows total days k in advance: \text{cost}(\text{OPT}) = \min(k, B)
What is the best deterministic decision rule?
The Break-Even Strategy
“Rent for B - 1 days. If you ski on day B, buy immediately!”
Why Day B?
Let purchase cost B = \$10 (Rent = \$1/\text{day}). You buy on Day 10 if you ski:
For any purchase cost B and any vacation length k:
Formal Bound
If k < B: \frac{\text{cost}(\text{ALG})}{\text{cost}(\text{OPT})} = \frac{k}{k} = 1
If k \ge B: \frac{\text{cost}(\text{ALG})}{\text{cost}(\text{OPT})} = \frac{(B - 1) \cdot 1 + B}{B} = \frac{2B - 1}{B} = 2 - \frac{1}{B} < 2
\text{Competitive Ratio } c = \sup_k \frac{\text{cost}(\text{ALG})}{\text{cost}(\text{OPT})} = 2 - \frac{1}{B} < 2
Theorem: The Deterministic Lower Bound
No deterministic online algorithm for Ski Rental can achieve a competitive ratio strictly less than 2 (as B \to \infty).
The Intuition
Suppose a deterministic algorithm decides to buy on fixed day j:
Case 1 (j \le B): Adversary terminates vacation immediately after day j (k = j). \text{cost}(\text{ALG}) = (j - 1) + B, \quad \text{cost}(\text{OPT}) = j \text{Ratio} = \frac{j - 1 + B}{j} = 1 + \frac{B - 1}{j} \ge 1 + \frac{B - 1}{B} = 2 - \frac{1}{B} \xrightarrow{B \to \infty} \mathbf{2}
Case 2 (j > B): Adversary continues vacation to day j. \text{Ratio} = \frac{j - 1 + B}{B} > \frac{B - 1 + B}{B} = 2 - \frac{1}{B} \xrightarrow{B \to \infty} \mathbf{2}
Conclusion: The adversary exploits deterministic predictability. c = 2 is a hard barrier.
Why did the deterministic algorithm fail to beat 2?
The Core Insight
The adversary stopped the vacation on day B because it knew with 100% certainty that we would buy on day B!
If our buying day is a random variable, the oblivious adversary does not know when we will buy.
Scale costs continuously to [0, 1] by dividing by B (as B \to \infty):
Fixed Purchase Time z vs. Trip Length t:
\text{cost}(z, t) = \begin{cases} z + 1 & \text{if } z \le t \text{ (bought at } z) \\ t & \text{if } z > t \text{ (rented until } t) \end{cases}
Expected Cost \mathbb{E}[\text{cost}(t)]:
\mathbb{E}[\text{cost}(t)] = \int_0^t (z + 1) f(z)\, dz + t \int_t^1 f(z)\, dz
(Averaged over all randomized buying times z)
How should we choose the distribution f(z)?
The Equalizer Idea
If any trip length t resulted in a lower ratio than another, a clever adversary would always pick the length that maximizes the ratio.
Therefore, the optimal distribution makes the ratio constant for all t: \frac{\mathbb{E}[\text{cost}(t)]}{\text{OPT}(t)} = c \quad \iff \quad \mathbb{E}[\text{cost}(t)] = c \cdot t
Substitute our expected cost into the equalizer equation: \int_0^t (z + 1) f(z) dz + t \int_t^1 f(z) dz = c \cdot t
Differentiating both sides with respect to t (using Leibniz’s Rule):
\frac{d}{dt}\left[ \int_0^t (z + 1) f(z) dz \right] + \frac{d}{dt}\left[ t \int_t^1 f(z) dz \right] = \frac{d}{dt}[c \cdot t]
First term: (t + 1) f(t).
Second term (product rule): 1 \cdot \int_t^1 f(z) dz + t \cdot (-f(t)) = \int_t^1 f(z) dz - t f(t).
Combining: (t + 1) f(t) + \int_t^1 f(z) dz - t f(t) = c \implies \mathbf{f(t) + \int_t^1 f(z) dz = c}
Differentiating once more with respect to t: f'(t) - f(t) = 0 \implies \mathbf{f'(t) = f(t)}
The unique solution is an exponential distribution: \mathbf{f(t) = C e^t}!
Step 1: Normalize total probability to 1: \int_0^1 f(t) dt = 1 \implies C \int_0^1 e^t dt = C(e - 1) = 1 \implies \mathbf{C = \frac{1}{e - 1}} f(t) = \frac{e^t}{e - 1}
Step 2: Evaluate competitive ratio c (evaluate at t = 0): c = f(0) + \int_0^1 f(z) dz = \frac{e^0}{e - 1} + 1 = \frac{1}{e - 1} + 1 = \mathbf{\frac{e}{e - 1}}
Theorem (Karlin, Manasse, Rudolph, Sleator 1988)
Randomization strictly beats the deterministic lower bound of 2: c = \frac{e}{e - 1} \approx \mathbf{1.58197} < 2 No randomized online algorithm against an oblivious adversary can beat \frac{e}{e-1}!
Setup
Let G = (V, E) be a directed graph on n vertices with adjacency matrix A \in \{0, 1\}^{n \times n}. Let \varepsilon > 0 be a sufficiently small scalar such that the series converges.
Part (a) — Resolvent Identity [5 Marks]
Prove the matrix identity:
(I - \varepsilon A)^{-1} = \sum_{k=0}^{\infty} \varepsilon^k A^k
Part (b) — Graph Reachability [5 Marks]
Using the identity from Part (a):
Why is v reachable from u if and only if: \left((I - \varepsilon A)^{-1}\right)_{uv} > 0 \quad ?
How does this algebraic test avoid computing individual powers A, A^2, \dots, A^{n-1}?
Caution
⏱ Duration: 10 Minutes | 📝 Mode: Pen & Paper | 🎯 Total: 10 Marks
CS G526: Advanced Algorithms & ComplexityTulasimohan Molli