7/27/2019 Slides Algo-closest2 Typed
1/7
Divideand
Conquer
ClosestPairII
DesignandAnalysisofAlgorithmsI
7/27/2019 Slides Algo-closest2 Typed
2/7
TimRoughgarden
CorrectnessClaim
Room has one queen bed with a shared hallway bath. sink is in the bedroom, bath and shower independent
in the hallway.
Desk. Voice mail. Wireless Internet access (surcharge). Dial-up Internet access (surcharge). Cable/satellite
TV. Premium TV channels. Hair dryer. Iron/ironing board. Ceiling fan. Window opens.
Claim:Let beasplitpairwithd(p,q)
7/27/2019 Slides Algo-closest2 Typed
3/7
TimRoughgarden
ProofofCorrectnessClaim(A)Let
Note:Since
Proofof(A)[pandqaremembersofSyi.e.]
Note:
=>
StripthatdefinesSy
7/27/2019 Slides Algo-closest2 Typed
4/7
TimRoughgarden
ProofofCorrectnessClaim(B)(B):p=(x1,y1)andq=(x2,y2)areatmost7posiHons
apartinSy
KeyPicture:draw boxeswithcenterand
boommin{y1,y2}
7/27/2019 Slides Algo-closest2 Typed
5/7
TimRoughgarden
ProofofCorrectnessClaim(B)Lemma1:allpointsofSywith
y-coordinatebetweenthoseof
pandq,inclusive,lieinoneof
these8boxes.
Proof:First,recally-coordinatesofp,qdifferby
7/27/2019 Slides Algo-closest2 Typed
6/7
TimRoughgarden
ProofofCorrectnessClaim(B)Lemma2:Atmostonepoint
ofPineachbox.
Proof:bycontradicHonSupposea,blieinthesamebox.Then:
I. a,bareeitherbothinQorbothinRII. But(i)and(ii)contradictthedefiniHonof
(assmallestdistancebetweenpairsofpoints
inQorinR)
7/27/2019 Slides Algo-closest2 Typed
7/7
TimRoughgarden
FinalWrap-Up
Lemmas1and2=>atmost8
pointsinthispicture(includingpandq)
=>PosiHonsofp,qinSydiffer
byatmost7