Академический Документы
Профессиональный Документы
Культура Документы
and
Conquer
Closest
Pair
I
Design
and
Analysis
of
Algorithms
I
IniAal
ObservaAons
AssumpAon
:
(for
convenience)
all
points
have
disAnct
x-coordinates,
disAnct
y-coordinates.
Brute-force
search
:
takes
Ame.
High-Level
Approach
1. Make
copies
of
points
sorted
by
x-coordinate
(
)
and
by
y-
coordinate
(
)
[O(nlog(n))
Ame]
(but
this
is
not
enough!)
2.
Use
Divide+Conquer
Tim Roughgarden
Tim Roughgarden
Tem
ver
Requirements
1. O(n)
Ame
2. Correct
whenever
closest
pair
of
P
is
a
split
pair
Tim
Roughgarden
At
end
return
best
pair
Tim
Roughgarden
Correctness
Claim
Claim
:
Let
Assuming
claim
is
true!
Tim Roughgarden