Due 05.Apr.05 (Tue)
Before you tackle the homework, remind yourself of our general hw policies
Reading: Rosen §§ 2.2, 2.3 (skim), 6.1, 6.2, 6.3.
(5pts) You have written a great new on-line multiplayer game, World of MathCraft, where many players will log in to your central server and play. Suppose that, for n players, your server needs to process f(n) network packets per second.
(6pts)
new problem, compensating
for the deferral of the next two problems.
Read Rosen's Closest-Pair problem at the end of § 6.3 in detail,
and its very clever argument about why the ``conquer'' step of
divide-and-conquer runs in linear time.
Your friend Lÿnn Plaine has tried to improve on this algorithm by getting rid of the need to make a final pass looking for pairs of points which straddle the dividing line. Instead she'll make two overlapping sections, so that the closest pair is in one or the other. Given a set P of 2 or more points:
If |P| ≥ 3, she finds
two coordinates xa < xb
such than when she creates
PL = { (x,y) ∈ P | x < xb}
PR = { (x,y) ∈ P | xa < x}
she gets
|PL| =
|PR| = (2/3)⋅|P|,
as nearly as possible.
Such a coordinate can be found quickly,
if initially we sort the points by x-coordinate, as in Rosen.
(We gloss over glitches about not being a multiple of three, and will
also assume that no two points have the same x-coordinate.)
She recursively computes the closest-pair in each of PL and PR, returns the closer of these two pairs.
Searching for an improvement to her running time, you are brainstorming with her on ideas of how to shave the factor 2/3 down to any fraction strictly bigger than 1/2 — to 1/2+ε for any ε> 0, e.g. something like 51/100. In pushing the idea this far¹, the two of you start to get suspicious that this algorithm would really always work — couldn't the closest points happen to straddle that thin 2ε middle strip?
Even in the algorithm as described (reducing the problem size by 2/3), give a set of points such that the closest-pair is actually one point from PR-PL, and one point from PL-PR (thereby spanning the entire middle section PL∩ PR).
¹ Your brainstorm included ideas like