Announcements
Optional discussion section meets on Wednesday, 7-8pm at FCS 101
Largest Empty Rectangle Problem
Divide and conquer
function DivideAndConquer(A, m, n) begin
PrecomputeLeftRuns(...)
PrecomputeRightRuns(...)
return DivAndConq(A, m, 1, n, L, R)
end
DevAndConq()

PrecomputeLeftRuns() + PrecomputeRightRus()

Total number of rectangles
[m 2] * [n 2] = m*(m-1)/2 * n*(n-1)/2
(pair of rows) (pair of cols) theta(m^2) theta(n^2)
To sum up, for Largest Empty Rectangle, we’ve seen following algorithms:
- Exhaustive search (
time) - [Optimized exhaustive search (
time)] - Divide and conquer (
time) - [Dynamic programming (
time)] - [Amortization (
time)] (optimal)







: time for exhaustive search without any optimization
upper- and lower-bounded by constant times f(n)
upper-bounded by constant times f(n)
lower-bounded by constant times f(n)
(almost always)