Iterated Nearest Neighb ors and
Finding Minimal Polytop es
y z
David Eppstein Je Erickson
Abstract
Weintro duce a new metho d for nding several typ es of optimal k -p oint
sets, minimizing p erimeter, diameter, circumradius, and related measures, by
testing sets of the O (k ) nearest neighb ors to each p oint. We argue that this is
b etter in a number of ways than previous algorithms, whichwere based on high
order Voronoi diagrams. Our technique allows us for the rst time to eciently
maintain minimal sets as new p oints are inserted, to generalize our algorithms
to higher dimensions, to nd minimal convex k -vertex p olygons and p olytop es,
and to improvemany previous results. Weachievemany of our results via
a new algorithm for nding rectilinear nearest neighb ors in the plane in time
O (n log n + kn). We also demonstrate a related technique for nding minimum
area k -p oint sets in the plane, based on testing sets of nearest vertical neighbors
to each line segment determined by a pair of p oints. A generalization of this
technique also allows us to nd minimum volume and b oundary measure sets
in arbitrary dimensions.
1 Intro duction
Anumb er of recent pap ers have discussed problems of selecting, from a set of n
p oints, the k points optimizing some particular criterion [2, 14, 20]. Criteria that
have b een studied include diameter [2], variance [2], area of the convex hull [20],
convex hull p erimeter [14,20], and rectilinear diameter and p erimeter [2]. Such
problems are useful in clustering, line detection, statistical data analysis, and other
geometric applications.
We study and improveknown algorithms for these problems. Wealsointro duce
dynamic versions of these problems, in which the optimum set must b e maintained
as new p oints are inserted. Our metho ds further generalize to higher dimensional
versions of these problems. Our techniques apply to all of the problems cited ab ove.
Portions of this pap er were presented at the 3rd and 4th ACM-SIAM Symp osia on Discrete
Algorithms [17, 19]. This pap er includes work done while Je Erickson was at the Universityof
California at Irvine. David Eppstein's researchwas partially supp orted by NSF grant CCR-9258335.
y
Department of Information and Computer Science, University of California, Irvine, CA 92717
z
Computer Science Division, University of California, Berkeley, CA 94720 1
2 D. Eppstein and J. Erickson
Many of these problems were previously solved using the following metho d, orig-
inally develop ed byDobkin et al. [14]. An ad ho c algorithm was determined, with
c
time b ounded by a p olynomial O (n ). Then, it was shown that the optimum k -p oint
set is contained in the set of p oints lab eling a single region of the order-O (k )Voronoi
diagram. Constructing the Voronoi diagram and searching the O (kn) such regions
c+1
takes a total time of O (n log n + k n). Aggarwal et al. [2] reduced the number of
c
regions to b e searched from O (kn)to O (n). Thus the time b ecomes O (n log n + k n).
However, there remains an anomaly in these time b ounds: if k is (n), the time
c
is worse than the original O (n )by a factor of n.Thus at some p oint the device
of higher order Voronoi diagrams b ecomes worthless, and one must use a simpler
algorithm.
We argue that, in this formulation, Voronoi diagrams should b e replaced bysets
of the O (k ) nearest neighb ors to eachpoint. There are several reasons whywe
b elieve this. First, the reduction to O (n) regions to b e searched is immediate, and
avoids the complicated analysis of Aggarwal et al. [2].
Second, by nding neighb ors of neighbors, we show that the numb er of regions
can b e further reduced to O (n=k ), improving the time b ounds by a factor of k and
eliminating the anomaly describ ed ab ove.
Third, our time b ounds can b e improved in a di erentway. The k nearest
neighb ors can b e found in time O (kn log n), using Vaidya's algorithm [34]. For the
rectilinear (L or L ) metric, we further improve this to O (n log n + kn) on a random
1 1
access machine. Thus we get faster time b ounds in the plane, even for problems
such as circumradius for which the reduction to Voronoi diagrams is immediate.
Fourth, our metho d lends itself well to dynamization. As p oints are inserted one
at a time, the neighb ors of eachnewpointmay b e computed quickly using standard
techniques. In contrast, the Voronoi diagram maychange byasmanyas (n) edges
at each insertion. Dynamic algorithms have b een studied for many imp ortant geo-
metric optimization problems, such as the closest pair, diameter, minimum spanning
tree, and convex hull, but this is the rst time that dynamic algorithms have b een
describ ed for minimum measure subset problems.
Fifth, our approach generalizes to higher dimensions in a way that do es not
work for Voronoi diagrams. In dimension d,even rst order Voronoi diagrams can
dd=2e
have complexity (n ); whereas, the nearest neighb ors can still b e found in time
O (n log n) using Vaidya's algorithm [34].
Finally,by applying an old combinatorial result of Erd}os and Szekeres [21],
we can generalize our techniques to nd minimum measure convex p olygons and
p olytop es.
Avariant of our technique also yields new algorithms for nding minimum area
k -p oint sets in the plane, or minimum b oundary measure or volume k -p oint sets in
arbitrary dimensions. Our b oundary measure algorithm is a natural generalization
of our minimum p erimeter result. Instead of using the neighb ors to each p oint, we
Nearest Neighb ors and Minimal Polytop es 3
Measure Static time b ound Dynamic time b ound
2
3 4
p erimeter O (n log n + k n) O (k +log n)
2
2 3
L p erimeter O (n log n + k n) O (k +log n)
1
2
2
circumradius O (n log n + kn log k ) O (k log k +log n)
2 2 2
2 3
diameter O (n log n + k n log k ) O (k log k +log n)
2 2 2
L diameter O (minfn log n + kn; n log ng) O (k log k +log n)
1
2
3=2 3=2+" 3+"
variance O (k n log n + k n) O (k + log n)
2 3 2
area O (n log n + k n ) |
Table 1. New results for nding minimum measure k -p oint sets, given n p oints in the plane.
(" is an arbitrarily small p ositiveconstant.)
let each set of r points in the set de ne a particular p olytop e, for some constant r
de ned by the measure we are trying to minimize, and we examine the nearest
neighb ors to each p olytop e thus de ned. In particular, weshow that the minimum
area k -p oint set is contained in the O (k ) nearest vertical neighbors to a line segment
determined bytwo of its p oints.
2 New Results
We present algorithms for the following problems.
We nd the k nearest rectilinear (L or L ) neighb ors to eachofasetofn
1 1
points in the plane, in time O (n log n + kn), improving the previous O (kn log n)
b ound [34].
2
We nd the k nearest vertical neighb ors to each of the O (n ) line segments
2 2
determined by pairs of p oints in an n-p oint set, in total time O (kn + n log n).
Given a set of n points in the plane, we nd the k -p oint set minimizing p erime-
ter, L p erimeter, circumradius, diameter, L diameter, variance, or area.
1 1
Our results are summarized in the rst column of Table 1. Weimprove all
previous results [2, 14, 20], except for variance and area, whichweimprove for
certain values of k .
We maintain minimal p oint sets in the plane as p oints are inserted, under
avariety of \one-dimensional" measures. Our results are summarized in the
second column of Table 1. No previous b ounds are known for any of these
problems.
d
Givenasetofn points in IR , with d> 2, we nd the k -p oint set min-
imizing circumradius, diameter, L diameter, variance, b oundary measure, 1
4 D. Eppstein and J. Erickson
Measure Time b ounds
2
d 1
circumradius O (kn log n + k n log k )
O (k )
diameter O (kn log n +2 n)
2
d=2 1
L diameter O (kn log n + k n log k )
1
2
(d+1)=2 O (d )
variance O (k n log n + k n log k )
d O (k ) d 1
b oundary measure O (n +2 n )
d 2d 1 d 1
L b oundary measure O (n + k n )
1
d+1
d O (k ) d
volume O (kn log n +2 n )
d
Table 2. New results for nding minimum measure k -p oint sets, given n points in IR , for
all d> 2.
L b oundary measure, or volume. Our results are summarized in Table 2. We
1
improve previous algorithms for circumradius and variance based on Voronoi
d+1
diagrams, which run in time O (n ) [2]. No previous b ounds were known for
the other problems.
We generalize all of our results to k -p ointconvex p olygons and p olytop es.
We derive time b ounds with the same dep endence on n as the corresp onding
k -p oint set algorithms, but with an exp onential dep endence on k .Weknow
3
of no previous results for these problems, except for a O (kn ) time b ound on
nding minimum area or p erimeter k -gons [20], whichwe improve for small k .
3 Rectilinear Nearest Neighb ors
We b egin by describing a data structure for nding m rectilinear nearest neighb ors
in the plane. In the L metric, ab ove and to the rightofanypoint p,points (x; y )
1
are sorted by distance to p by the values of the function x + y .Ifwe sort all p oints
by these values, the nearest neighb ors ab ove and to the rightofeachpoint will
b e a subsequence of this sorted list. Wecombine neighb ors from each of the four
directions to nd the nearest neighb ors overall.
Our data structure is in the form of a balanced binary tree over the p oints, sorted
by their y -co ordinates. The tree ro ot covers all n points, and for eachtreenodewith
i p oints we split the p oints into two slabs, consisting of the top i=2 and the b ottom
i=2points. We build a data structure for each slab, and recursively sub divide slabs
until we reach sets of a single p oint. Each input p oint will b e in O (log n) slabs, and
the p oints ab ove and to the rightofany query p oint p can b e interpreted as the
union of p oints to the rightofp in O (log n) slabs ab ove p.
We assume m is xed. Without loss of generality m> log n. (Otherwise, we
will build our data structure to nd log n nearest neighb ors, from whichwe can
quickly cho ose the nearest m.) In each slab, we wish to determine, for a query
Nearest Neighb ors and Minimal Polytop es 5
p oint p,them nearest p oints to the rightofp.Ifwe did this for all slabs, wewould
generate O (m log n) neighb ors, and queries would b e slower than we wish. Instead,
we partition the neighb ors into chunks of (m= log n)points. Our data structure
will enable us to nd each succeeding chunk quickly, and we then combine chunks
from di erent slabs to give the nal set of m neighbors.
Within a single slab, wesweep from left to right, maintaining a list of p oints
ordered by x + y .Aswesweep across eachpoint in the slab, we add it to the list.
The p ositions to add new p oints into the list can b e found in time O (n)ifthepoints
are already sorted by x-co ordinate. Wewould like our data structure to reconstruct
the state of this list at each time in the sweep. This is a persistent oine data
structure problem [18], in whichweperformanumb er of up dates (insertions into a
linked list) and must then query di erentversions of the data structure (the list at
di erent times in the sweep).
Wemaintain, at eachpoint in the left to rightsweep, a partition of the sorted
list of p oints into chunks of b etween m= log n and 2m= log n points each. When a
new p oint is inserted in the list, it is added to a chunk. When this addition causes
achunk to have to o many p oints, it is split into smaller chunks. As we only need
remember at most m neighb ors to each query p oint, we only need keep log n chunks,
so as one chunk is split another chunk may b e removed from the end of the list.
To rememb er these manipulations we store the list of p oints in eachchunk just
b efore the chunk is split, and the list of all log n chunks at the same time. To nd
the neighb ors for a query p oint p,we determine the next time t after our left-to-right
sweep crosses p, at which some chunk is split. We then step through the sequence
of chunks existing at time t.Eachchunk contains b etween m= log n and 2m= log n
p oints, of which at least m= log n existed at the last time the chunk was split and
hence are to the rightofp.We eliminate the other p oints to the left of p.Thus
in time O (m= log n)we can nd each successivesetof (m= log n) neighb ors in the
slab.
The time and storage for rememb ering the p oints in eachchunk is O (n). However
if m is small there are O (n) times at whichachunk may split, and hence O (n log n)
storage for rememb ering the sequence of chunks at each time. Weremovethis
unwanted logarithmic factor with a data structure for maintaining lists of O (log n)
elements in a p ersistent oine manner.
Lemma 3.1. Given a sequence of n insert and delete op erations on a list, such
that the list length is always O (log n),we can construct in time and space O (n) a
data structure such that, for anyversion of the list, we can step through the list in
time O (1) per step.
Pro of: Break the sequence into O (n= log n) subsequences of O (log n) op erations
each, and treat each subsequence separately. Within a subsequence, there are
O (log n) items initially, and O (log n) items inserted. List all items by pro cess-
ing all the insert op erations and none of the delete op erations. Represent this list
6 D. Eppstein and J. Erickson
as an array of p ointers to items, so that the item in a given p osition can b e found
in O (1) time. Now represent eachversion of the list byanO (log n)-bit integer, in
which a one bit represents the presence of the item at that p osition. Each insert or
delete can b e p erformed with O (1) steps of integer arithmetic on a random access
machine, as can the op eration of moving from one element to the next in a given
version of the list. 2
By analogy to the atomic heaps of Fredman and Willard [23]we call this data
structure an atomic list. This completes the description of each slab, whichwe
summarize b elow.
Lemma 3.2. Given n p oints in the plane, sorted from left to right, we can in time
and space O (n) construct a data structure for which, given a value x,we can nd
the p oints with the smallest values of x + y ,inchunks of O (m= log n) points at a
time, in time O (m= log n) per chunk. 2
To nish the description of our data structure, wecombine results from the
O (log n) slabs into which space ab ove the query is divided. Weuseapriority queue
of one chunk from each slab. Eachchunk's priority is the largest value of x + y for any
p oint in the chunk. We removechunks one by one from the queue; when weremove
achunk we insert the next chunk from the same slab. Once wehaveremoved chunks
totalling at least m points, any remaining neighb ors will have smaller values of x + y
than the priorities of the chunks left in the queue. Suchpoints must b e in chunks
already in the queue, and we remove these chunks as well. This gives us O (log n)
chunks and hence O (m) p otential neighbors. We reduce this to m neighbors using a
linear time selection algorithm. Using a global list of all p oints, sorted by x + y ,we
can represent priorities as O (log n)-bit integers, so we can p erform priority queue
op erations in O (1) time using atomic heaps [23].
Lemma 3.3. For any xed m,we can prepro cess a set of n p oints in the plane, in
time and space O (n log n), so that the m nearest rectilinear neighb ors to any query
p oint can b e found in time O (m +logn).
Pro of: The query time is O (m +log n), once wehave determined the version of the
chunk list to use in each slab. For each slab, wemaintain an index from the left
to right order of p oints into this sequence of versions. We also index, for each slab,
the relation b etween p ositions in the left to right order of p oints in the slab, and
the same p ositions in the two smaller slabs into which it is divided. The p osition of
the query p oint in the ro ot slab can b e found by binary search, after whichwe can
follow the indices to nd the list versions for all O (log n) slabs queried in O (log n)
time. The time to construct eachslabisO (n) assuming the p oints are sorted from
left to right. This sorted order can b e maintained as slabs are split recursively,
in O (n log n) total time. Each slab requires space O (n). Thus all slabs can b e
constructed in time and space O (n log n). 2
Nearest Neighb ors and Minimal Polytop es 7
Theorem 3.1. We can nd the m nearest rectilinear neighb ors to eachofasetof
n p oints in the plane, in time O (n log n + mn) and space O (n log n). 2
Remark. Our nearest neighb or algorithm relies on the constant-time manipulation
of O (log n)-bit integers, in b oth the atomic lists and atomic heaps. Thus, our time
b ound holds only in the RAM mo del of computation. In the algebraic decision tree
mo del, our time b ound climbs by a factor of O (log log n).
4 Iterated Nearest Neighb ors
Wenowshow that in anypointset,inany dimensions, there is some p oint for which
there are few neighb ors of neighb ors. We state the result more generally,interms
of spheres satisfying certain prop erties. Given two spheres A and B ,wesay that A
is entirely within B if the closure of A is contained in the interior of B .
Lemma 4.1. Let S b e a set of spheres, so that no sphere is entirely within another
sphere, and so that no sphere contains more than m centers of spheres. Let S be
the smallest sphere in S , and let U b e the union of spheres in S having centers in
S . Then U contains O (m) sphere centers.
Pro of: Let R denote the radius of S . Because no sphere in U contains S ,itfollows
that U is contained in a sphere of radius 3R. This larger sphere can b e partitioned
into O (1) regions, each with diameter R. If any of these regions contained more
than m centers, any sphere centered in such a region either would contain to o many
centers or would b e smaller than S . 2
This result applies more generally to any family of homothetic convex b o dies,
and hence to \spheres" in any metric. We apply this result to sets of m nearest
neighb ors as follows. Given a p oint set, put a sphere around each p oint at a radius
determined byits mth nearest neighbor. This sphere will contain exactly the m
nearest neighb ors of the p oint, and the set of all such spheres will satisfy the condi-
tions of the lemma. Therefore there is some p oint for which the m nearest neighb ors
have O (m) neighb ors altogether.
This suggests the following algorithm outline. Supp ose we can prove that the
optimal k -p oint set (according to some sp eci ed criterion), if it contains a p oint, is
contained in the m nearest neighb ors of that p oint. Sort the p oints by the size of
their neighb or spheres. Collect the neighb ors of the p oints in the smallest neighbor
sphere, search for the optimal set among them, and throw out the m +1 points in the
sphere. Rep eat the preceding step until all p oints are gone, but if a smallest neighbor
sphere ever contains fewer than k points, we throw out its center immediately, since
that p oint cannot p ossibly b e in the optimal set.
8 D. Eppstein and J. Erickson
Lemma 4.2. Let b e a measure having the prop erty that the minimum measure
k -p oint set is contained in the m rectilinear nearest neighb ors of each of its p oints,
and let T (m) (resp. S (m)) b e the time (resp. space) required to nd the optimal
d
k -p oint set among m p oints. Then, given a set of n points in IR ,we can nd the k -
p oint subset minimizing ,intimeO (mn log n + nT (m)=k ) and space O (mn + S (m)),
or in time O (n log n + mn + nT (m)=k ) and space O (n log n + mn + S (m)) if d =2.
Pro of: By our results ab ove, the rectilinear nearest neighb ors can b e found in time
O (n log n + mn) and space O (n log n) in the plane. In higher dimensions, we use
Vaidya's algorithm [34]. We only call the ad ho c algorithm when the neighb or sphere
contains k or more p oints, and those p oints are immediately discarded. Thus, the
ad ho c algorithm is called at most dn=k e times, each time on a set of size O (m)by
the previous lemma. These two op erations dominate the time and space b ounds.
We claim that at anypoint in the algorithm, if the minimal set has not yet
b een found, it contains only p oints that have not b een thrown out. Weprovethis
claim by induction; it is clearly true when the algorithm starts. If anypoint p is
in the set, then by assumption, the set is contained in p's neighb or sphere. If this
sphere contains fewer than k points, p cannot p ossibly b e in the set, and we can
safely discard it. The only other time p could b e thrown out is immediately after
wesearch for the minimal set among p's remaining neighb ors. If the minimal set
contains p, then by the inductivehyp othesis, this search will nd it. 2
The same algorithm outline will still work if the minimum measure set is con-
tained in the nearest neighb ors of each of its p oints, under any xed metric. Thus, in
higher dimensions, we could use Euclidean neighb ors instead of rectilinear neighb ors
without changing the time b ounds.
5 Minimizing One-Dimensional Measures
5.1 Perimeter
We rst demonstrate our technique on the minimum p erimeter k -p oint set problem.
The problem is to nd, given a set of n points in the plane, a set of k points for
which the p erimeter of the convex hull is minimized. This was previously solved in
2 5
O (k n log n + k n) time by Dobkin et al. [14]; this can b e improved to O (n log n +
4
k n) using the techniques of Aggarwal et al. [2] Both algorithms use a dynamic
3
programming algorithm, requiring time O (kn ) and space O (kn), as a subroutine
within each region of a certain high order Voronoi diagram [14]. We will use this
algorithm as a subroutine within each set of nearest neighbors.
Lemma 5.1. If a p oint p is in the minimum p erimeter k -p oint set, then the set is
contained in the O (k ) nearest rectilinear neighbors of p.
Nearest Neighb ors and Minimal Polytop es 9
Pro of: Let q b e the farthest p oint from p in the optimal set. Then the entire set
ts in a circle around p, of radius jpq j, and the p erimeter must b e at least 2jpq j. But
we can cover the circle with 16 squares of p erimeter jpq j;if q is not among the 16k
rectilinear nearest neighb ors of p then some square must contain at least k p oints,
and would supply a k -p oint set with smaller p erimeter. 2
Wepoint out that this lemma is also true for Euclidean neighb ors, or neighb ors
under any xed metric, with only a change in the constant factor. This will b e true
for almost all of our nearest-neighb or results.
Theorem 5.1. We can nd the minimum p erimeter k -p oint subset of a set of
3 2
n p oints in the plane, in time O (n log n + k n) and space O (n log n + kn + k ).
Pro of: This is a direct application of the two-dimensional case of Lemma 4.2. We
3
have m = O (k )by the previous lemma, and T (m)= O (km )andS (m)= O (km)
from [14]. 2
This algorithm generalizes to minimize p erimeter in any metric, but wecando
b etter in L . The minimum L p erimeter k -p oint set is the set enclosable in the
1 1
minimum p erimeter axis-aligned rectangle. Aggarwal et al. [2] solve this problem in
2 3
time O (k n log n). We use their O (n )-time brute force algorithm as a subroutine.
Theorem 5.2. We can nd the minimum L p erimeter k -p oint subset of a set of
1
2
n p oints in the plane, in time O (n log n + k n) and space O (n log n + kn). 2
5.2 Circumradius
Wenow describ e our algorithms for nding the k -p oint set contained in the smallest
d
sphere, given a set of n p oints in IR .We improve previous time b ounds, due to
2 d+1
Aggarwal et al. [2], of O (n log n+k n) in the plane and O (n ) in higher dimensions.
Their algorithms are based on higher order Voronoi diagrams.
First wedevelop a new algorithm to use as a subroutine within each neighbor
set. Consider the related problem of placing a xed-size sphere so that it covers the
maximum number of a given set of p oints. Once wehave a solution to this problem,
we can apply Megiddo's parametric searchtechnique [29] to nd the smallest sphere
whose optimal placementcovers k (or more) p oints.
Lemma 5.2. We can nd the minimum circumradius k -p oint subset of a set of
2
d
d d
n points in IR ,intimeO (n log n) and space O (n log n), or in time and space
2
O (n log n) if d =2.
10 D. Eppstein and J. Erickson
Pro of: First consider the sphere placement problem. We xeachsetofd 1
p oints and rotate a sphere around its ane hull, stopping whenever a p ointenters
or leaves the sphere. Eachsweep requires time O (n log n). Degenerate cases, where
the optimal sphere cannot b e forced to b e tangenttod points, are handled in total
d 1 d
time O (n ). Thus, the entire sweep algorithm takes time O (n log n). In the
2
plane, wecansolve this problem in time and space O (n ), using a more complicated
algorithm develop ed by Chazelle and Lee [8].
To nd minimum circumradius sets, we apply parametric searching with Cole's
weighted median strategy [10]. Our sweep algorithm can b e parallelized to run in
2
d d
O (log n) steps on O (n ) pro cessors. Thus, the total time is O (n log n) in general,
2
and O (n log n) in the plane. The parametric search technique requires the con-
d
struction of an AKS sorting network [3] with O (n ) inputs, one for each pro cessor
used by the parallel implementation of the xed-parameter algorithm. This network
d
can b e built in time and space O (n log n)[3]. 2
Lemma 5.3. If a p oint p is in the minimum circumradius k -p oint set, then the set
is contained in the O (k ) rectilinear nearest neighbors of p.
Pro of: Let R b e the optimal circumradius. The minimum circumradius set is con-
tained in an axis-aligned hyp ercub e of width 4R,centered at p. This hyp ercub e can
p
d
b e partitioned into (2 d) = O (1) axis-parallel hyp ercub es with circumradius R,
none of which can contain more than k points. 2
Theorem 5.3. We can nd the minimum circumradius k -p oint subset of a set of
d 2
d 1 d
n p oints in IR ,intime O (kn log n + k n log k ) and space O (kn + k log k ),orin
2
time O (n log n + kn log k ) and space O (n log n + kn + k log k ) if d =2. 2
5.3 Diameter
The diameter of a set is the largest distance b etween anytwopoints in the set.
In the plane, Aggarwal et al. [2] showhow to nd the minimum diameter k -p oint
2:5
set in time O (n log n + k n log k ). Unfortunately,weknow of no fully p olynomial
algorithm for this problem in higher dimensions, so we are forced to use a brute
force approach.
Lemma 5.4. If a p oint p is in the minimum diameter k -p oint set, then the set is
contained in the O (k ) rectilinear nearest neighbors of p.
Pro of: Let D b e the optimal diameter. The minimum diameter set is contained
in an axis-parallel hyp ercub e of width 2D ,centered at p. This hyp ercub e can b e
partitioned into a constantnumb er of smaller hyp ercub es with diameter D ,noneof
which can contain more than k p oints. 2
Nearest Neighb ors and Minimal Polytop es 11
Theorem 5.4. We can nd the minimum diameter k -p oint subset of a set of
d
O (k )
n p oints in IR , in time O (kn log n +2 n) and space O (kn), for all d> 2. 2
We can do considerably b etter than this in the plane. Aggarwal et al. [2]solve
this problem by reducing it to one of nding a maximum indep endent set in a certain
bipartite graph. For bipartite graphs, the maximum indep endent set and maximum
matching are closely related (their cardinalities add to the size of the p ointset)so
matching techniques can b e applied to this problem.
We improve on the algorithm of Aggarwal et al. by solving a dynamic matching
problem. Given a p ointsetS , and a distance D , let the graph G (S ) b e de ned
D
as follows. The vertices of G (S ) are simply the p oints in S . An edge (p; q ) will
D
exist in the graph exactly when jpq j >D; that is, the graph connects p oints that
are suciently far apart.
Lemma 5.5. Given a set S of n points, such that G (S ) is bipartite, and a maxi-
D
mum matching in G (S ),we can insert or delete a single p ointin S and up date the
D
maximum matching, in time O (n log n) and space O (n),provided G (S ) remains
D
bipartite.
Pro of: The up date can only change the matching cardinalityby one. If the up date
is a deletion of a matched p oint, weremove its edge from the matching and mark
its mate as unmatched. Then whether the up date is an insertion or a deletion, the
remaining problem is to nd a single alternating path connecting two unmatched
p oints. If such a path is found, the matching size can b e increased bychanging the
unmatched edges in it to matched edges, and vice versa.
We will go through a pro cess of marking p oints as odd or even. A p oint is lab eled
o dd (even)ifitcanbereached from an unmatched vertex by an alternating path
of o dd (even) length. In each case we rememb er the last edge on the path, so that
the entire path can b e reconstructed quickly. Once wehave p erformed this lab eling,
the existence of an alternating path can b e tested by testing if anytwoeven p oints
share an edge. This can b e done in O (n log n) time by nding the farthest pair of
even p oints.
We will maintain a data structure for a p ointsetP with the following op erations:
(1) given p oint p, nd some p ointinP farther than D from p, or rep ort that no such
p oint exists; (2) delete a given p oint from P . As noted by Aggarwal et al. [2], these
op erations can b e p erformed in O (log n) amortized time and linear space using the
circular hul l data structure of Hershb erger and Suri [25].
We start the lab eling pro cess by marking each unmatched p ointaseven (it has a
zero length path to an unmatched p oint). We build the data structure ab ove, letting
P consist of all unmarked p oints (initially, that is simply the matched p oints). We
then process each marked p oint in turn, maintaining a queue of p oints that require
pro cessing. Pro cessing an o dd p oint consists simply of marking its matcheven,
12 D. Eppstein and J. Erickson
adding it to the queue, and removing it from P . We pro cess the even p oints as
follows. While an unmarked p oint adjacent to the even p oint exists, wemarkit
o dd, add it to the queue, and removeitfromP . Suchapoint can b e found using
the nd op eration describ ed ab ove.
Once the queue is empty, all p oints are either marked or unreachable via an
alternating path. The numb er of data structure op erations is O (n), as each nd
op eration either discovers a new p ointtobemarked and removed from P ,oritis
the last such op eration p erformed in pro cessing a given p oint. Therefore the total
time used is O (n log n). The circular hull structure and the queue b oth use linear
space, so the overall space b ound is linear. 2
Lemma 5.6. We can nd the minimum diameter k -p oint subset of a set of n points
2
3
in the plane, in time O (n log n) and space O (n).
Pro of: Eachpoint can b e the endp ointofO (n) p ossible diameters; we select among
them using binary search. To test a given diameter D asso ciated with a p oint p,we
want to know whether there is some k -p oint set with diameter jpq j shorter than D .If
so, the set is contained in the lune formed byintersecting two circles of diameter D ,
one centered on p and one centered at distance D from p.Wesweep a lune around p,
covering in turn O (n) di erentpoint sets; wemust test if any of these sets contains
a small diameter k -p oint subset.
As noted by Aggarwal et al. [2], if S is the p ointsetcontained in a given lune,
then G (S ) is bipartite, and a subset of S with diameter less than D is exactly an
D
indep endent set in G (S ). If M is the maximum matching in G (S ), the size of the
D D
maximum indep endent set is jS j jM j.Thus to test if there is a large subset with
small diameter, wemay compute this matching. We do this for all O (n) p ositions
2
of the lune around p,intime O (n log n), using the dynamic matching algorithm of
Lemma 5.5.
For each p oint, we p erform a binary search among its O (n) asso ciated diameters,
and there are O (n)points for which this searchmust b e p erformed. Thus, the total
2
3
time used is O (n log n). 2
Combining this algorithm with Lemmas 4.2 and 5.4, wehave the following result.
Theorem 5.5. We can nd the minimum diameter k -p oint subset of a set of
2
2
n p oints in the plane, in time O (n log n + k n log k ) and space O (n log n + kn). 2
5.4 L Diameter
1
The algorithms in the previous two sections generalize to circumradius and diameter
in any metric, but we can make a signi cant improvementin L . The minimum 1
Nearest Neighb ors and Minimal Polytop es 13
L diameter (equivalently, minimum L circumradius) k -p oint set is the set en-
1 1
closable in the smallest axis-aligned hyp ercub e. In the plane, Aggarwal et al. [2]
give an algorithm for this problem, based on higher order L Voronoi diagrams,
1
2
that takes time O (k n log n).
Our approach is almost identical to that used to nd minimum circumradius
sets. We start with the problem of placing a xed-size axis-aligned hyp ercub e so
that it covers the maximum number of points. Once wesolve this problem, we can
parameterize it to nd the smallest axis-parallel hyp ercub e that covers at least k
p oints. Instead of parametric search, weuseamuch simpler binary search among
the p ossible L diameters.
1
Lemma 5.7. We can nd the minimum L diameter k -p oint subset of a set of n
1
2
d
d=2 d=2
p oints in IR , in time O (n log n) and space O (n ).
Pro of: Finding the optimal placementofahyp ercub e is equivalent to nding the
deep est p oint in an arrangementofhyp ercub es. We can easily adapt an algorithm
of Overmars and Yap [32], originally applied to Klee's measure problem, to nd
d=2
the deep est p oint in an arrangement of axis-aligned b oxes in time O (n log n) and
d=2
space O (n ).
To nd the optimal hyp ercub e size, we search along each co ordinate axis as
follows. We sort the p oints by the appropriate co ordinate, and de ne a triangular
matrix M of co ordinate di erences. These di erences are p otential L diameters.
1
2
We will not actually build M , since that would require time (n ), but we can
access anyentry in constant time. We binary search through M for the optimal
diameter. Since the rows and columns of M are sorted, we can select any elementin
time O (n log n)[22]. Thus, each step of the search is dominated byOvermars and
2
d=2
Yap's algorithm, and the entire search requires time O (n log n). 2
Theorem 5.6. We can nd the minimum L diameter k -p oint subset of a set of
1
d 2
d=2 1 d=2
n points in IR , in time O (kn log n + k n log k ) and space O (kn + k ),orin
time and space O (n log n + kn) if d =2. 2
Our planar algorithm's time and space b ounds are dominated by the rectilin-
2
ear nearest neighb ors subroutine. For k = (log n), the \ad ho c" algorithm of
Lemma 5.7 is b oth faster and more space-ecient.
5.5 Variance
The variance of a set of p oints is de ned as the sum of the squares of the distances
between pairs of p oints, divided by the number of points in the set. Equivalently, the
variance is the sum of the squares of the distances from eachpoint to the centroid
of the set [2].
14 D. Eppstein and J. Erickson
Lemma 5.8. If a p oint p is in the minimum variance k -p oint set, then the set is
d=2+1
contained in the O (k ) rectilinear nearest neighbors of p.
Pro of: Let V and R be the variance and circumradius of the minimum variance
2 2
set, and let p be any p oint in the set. We easily verify that 2R set is contained in an axis-parallel hyp ercub e centered at p with width 4R.We can p d=2 partition this hyp ercub e into O (k )hyp ercub es of width 2R 2=dk, and thus of p circumradius R 2=k .Ifany of these spheres contain k points, their variance is at 2 most 2R , which is less than V . 2 Aggarwal et al. [2] prove that the minimum variance k -p oint set corresp onds to one of the cells in the k th order Voronoi diagram of the original n points and derive 2 an algorithm that uses time O (n log n + k n) in the plane. Agarwal and Matousek [1] recently discovered an algorithm for constructing planar order-k Voronoi diagrams 1+" 1 in time O (kn ). Combining their algorithm with our techniques, we can nd 2+" minimum variance sets in the plane in time O (n log n + k n), which is slightly worse than the existing b ound. Lemma 5.9. Let p b e a p oint in the minimum variance k -p oint set, and let V be the set's variance. Supp ose for some constant c> 0, the distance b etween p and p (d+1)=2 the set's centroid is c V=k. Then the set is contained in the O (ck ) nearest Euclidean neighbors of p. Pro of: Let S b e the sphere, centered at the optimal set's centroid, whichjust contains the set, and let R b e the radius of S . S contains exactly k points [2]. p V=k. The space Then S is contained in a sphere centered at p with radius R +2c p (d 1)=2 between the two spheres can b e covered by O (ck ) spheres of radius V=k, none of which can contain k points. 2 The two previous b ounds are tight in the worst case. Consider a sphere S of 1 p p k , containing a smaller sphere S of radius k=2tangenttoS . There is a radius 2 1 cluster of k 2 p oints with arbitrarily small variance around the center of S , but 2 excluding the center itself. The surface of S and the space b etween the two spheres 2 are b oth lled with as many clusters of k=2points as p ossible, such that every two clusters have at least unit distance b etween them. One of these clusters contains the center of S ; another contains the tangent p oint of the two spheres. The minimum 1 variance set consists of the large cluster, the center of S , and the tangent p oint. 1 For eachpoint p in this set, every sphere centered at p that contains the set also (d+1)=2 d=2+1 contains (k ) other p oints, and the set contains the (k )th neighbor of the center of S . 1 1 Throughout this pap er, " represents an arbitrarily small p ositive constant. Multipli cati ve constants hidden bytheO -notation may dep end on ". Nearest Neighb ors and Minimal Polytop es 15 To nd the minimum variance set quickly,we need to nd a center point within p radius c V=k of the optimal set's centroid, for some constant c>0, so that we can (d+1)=2 search for the optimal set among its O (ck ) nearest neighbors. We describ e an algorithm the nds a set of O (n=k )points, at least one of whichisacenter p oint. Theorem 5.7. We can nd the minimum variance k -p oint subset of a set of 3=2 3=2+" 5=2 n p oints in the plane, in time O (k n log n + k n) and space O (kn + k ). Pro of: We b egin by nding the k=2 nearest Euclidean neighb ors to every p oint, in time O (kn log n) and space O (kn). We rep eatedly nd the p oint p with the smallest neighb or sphere. If neither p nor any of the neighb ors of p are already marked noncentral, we mark p as a p otential center p oint and mark its neighb ors as noncentral. Eachcentral p ointmarksk=2 noncentral p oints, so this pro cess gives us O (n=k ) p otential center p oints. The entire marking pro cess requires time O (n log n + kn). p Most of the p oints in the minimal set are within 2V=k of the centroid, so every p 2V=k. Let p b e one p oint within this radius has at least k=2 neighb ors within 2 of these p oints. When the marking algorithm reaches p, one of two things happ ens. (1) We could mark p as a p otential center p oint. (2) We could ignore p b ecause p or p one of its neighb ors is marked noncentral, in which case some p oint within 5 2V=k of the centroid is already marked central. Thus, at least one of the p otential center p oints is an actual center p oint. 3=2 After we nd the p otential center p oints, we nd the O (k ) nearest Euclidean 3=2 neighb ors of each p otential center p oint in time O (k n log n) and space O (n). We 5=2+" 5=2 then test eachoftheO (n=k ) neighb or sets in time O (k ) and space O (k ) using Agarwal and Matousek's Voronoi diagram algorithm [1]. 2 " This algorithm matches or improves previous time b ounds for all k in O (n ) \ 2 2 (log n). For smaller values of k ,theO (n log n + k n)-time algorithm of Aggarwal et al. is faster. For larger values of k , Agarwal and Matousek's Voronoi diagram al- 1 " gorithm is faster. Finally,fork = (n ), the fastest algorithm is based on another 2 2 Voronoi algorithm of Chazelle and Edelsbrunner [6] and runs in time O (n log n). Mulmuley describ es an algorithm that constructs the k th order Voronoi diagram d+1 d+1 d d e b c d 2 2 2 of a set of n p oints in IR , in time O (k n log n + k n )[30]. To nd minimum variance sets in higher dimensions, we use Mulmuley's algorithm as a subroutine d+1 within eachneighbor set. We improve the previous time b ound of O (n ) [2]. Theorem 5.8. We can nd the minimum variance k -p oint subset of a set of d (d+1)=2 v (d) 1 v (d) n p oints in IR , in time O (k n log n + k n log k ) and space O (n + k ), 2 2 d +3d+4 d +4d+3 where v (d)= if d is even, and if d is o dd. 2 4 4 16 D. Eppstein and J. Erickson 6 Dynamization Wenowshowhow to turn our planar algorithms into dynamic data structures, that can maintain the minimum measure k -p ointsetaspoints are inserted. Our algorithm is simply to maintain a data structure that can determine, for each new p oint, its O (k ) nearest neighb ors. Then if that p ointispartofasetimproving the previous optimum, that set will b e a subset of these neighb ors, and can b e found using the metho ds already describ ed. Lemma 6.1. Let b e a measure having the prop erty that the minimum measure k -p oint set is contained in the m nearest neighb ors of eachofitspoints, and let T (m) (resp. S (m)) b e the time (resp. space) required to nd the optimal k -p oint set among m points. Then in the plane, we can maintain the k -p oint set minimizing 2 as p oints are inserted in time O (T (m)+ log n + m log n) p er insertion and space O (n log n + S (m)). Pro of: We apply a standard dynamic-to-static reduction technique for decomp os- able searching problems [4] to the rectilinear nearest neighb or data structure of Lemma 3.3. 2 Theorem 6.1. We can maintain the minimum measure k -p oint set in the plane as 2 4 p oints are inserted, with the following insertion times: O (k +log n) for p erimeter, 2 2 2 3 2 3 O (k + log n) for L p erimeter, O (k log k + log n) for circumradius, O (k log k + 1 2 2 2 2 3+" log n) for diameter, O (k log k +log n) for L diameter, and O (k +log n) for 1 variance. 2 We can dynamize our higher dimensional results in a similar manner, using a dynamic nearest neighb or data structure of Agarwal and Matousek [1], with results that are just slightly b etter than brute force. 7 Nearest Vertical Neighb ors Wenow consider the problem nearest vertical neighbors for p oints and line segments; we use this as a subroutine in our minimum area algorithm. Given a p oint p and a non-vertical line l , the vertical distance d(p; l ) is simply the length of a vertical line segment connecting p and l .Thenearest vertical neighbor to l from a p ointsetP is the p oint p 2 P minimizing the vertical distance to l . The connection b etween this concept and minimum area p olygons is as follows. If a triangle is formed by connecting p oint p to the endp oints of a line segment s, where s is contained in line l , the area of the triangle is c d(p; l ), where c is half the length of the pro jection of s onto the x-axis. Therefore the p ointinP forming the Nearest Neighb ors and Minimal Polytop es 17 Figure 1. Finding nearest neighb ors b etween lines and p oints: (a) primal, nearest p oint neighb or to a line; (b) dual, vertical ray sho oting in a line arrangement. minimum area triangle with s is the nearest vertical neighbor of l . This observation 2 was used to develop O (n ) algorithms for the minimum triangle problem [7, 16, 15]. We can tighten this characterization as follows. Let 4pq r b e the minimum area triangle, and assume that the vertical pro jection of r is b etween those of p and q . Then as b efore r is the nearest neighb or of line pq , but the vertical segment connecting r and line pq actually touches segment pq . In other words, r is within the slab de ned byvertical lines through p and q . In general wesay p is a neighbor of segment s if it app ears vertically ab oveorbelow s, as in this case r app ears ab oveorbelow segment pq . Then the triangle problem can b e solved by nding, for each segment pq , the nearest neighb ors ab ove and b elow pq . Computing nearest neighb ors to segments is harder than the original problem of nearest neighb ors to lines but it generalizes to minimum area k -gons in a way that do es not work for nearest neighb ors to lines. Givenasetofn points, and a segment s (whichmay not b e determined bytwo of the p oints) wesaythatthek nearest vertical neighbors ab ove(below) s are those k p oints ab ove(below) the line through s, and within the slab de ned byvertical lines through the endp oints of s, such that no other p oint with the same restrictions is closer to s.We compute these k nearest neighb ors as follows. First, supp ose we only care ab out the restriction that the p oints b e ab oveor b elow the line l through s; this is the earlier problem of nearest neighb ors to a line. By geometric duality,we can transform the line to a p oint and the p oint set to a line arrangement; Figures 1(a) and 1(b) illustrate this transformation. Point-line vertical distances are the same in the dual as they were in the primal. Therefore the dual nearest neighb or is the rst line encountered byavertical raysent from the dual p oint l .Thek nearest neighb ors are the rst k lines encountered. Thus we can nd these neighbors by ray-shooting in the dual arrangement. This do es not quite solve the problem we p osed, b ecause wehave not dealt with the requirement that p oints b e ab ove or b elow the segment s, only that they b e ab ove 18 D. Eppstein and J. Erickson or b elow the line containing s.Tosolve this we sort the p oints by their horizontal pro jections. As well as building an arrangementandray-sho oting data structure for the entire p oint set, we also build structures for the rst and second halves of the sorted lists of p oints, and so on recursively.Each data structure corresp onds to a vertical slab of the p oints; for each such structure there are two smaller structures corresp onding to slabs containing half as manypoints. Then for each query segment s,wecan ndasetofO (log n) slabs that contain exactly those p oints ab oveandbelow s.We can solvethek nearest vertical neighb ors problem by p erforming ray-sho oting queries within each slab, and selecting the b est k p oints found. Wenow describ e the data structures which allow us to p erform these ray-sho oting op erations and therefore nd the nearest vertical neighb ors. Rather than build a data structure that allows line segments to b e tested in arbitrary order, we test the segments in left-to-right order of the p oints dual to the lines containing them. This allows us to p erform our algorithm as a plane sweep of the dual line arrangement; that is, wesweep a vertical line from left to right across the dual plane, and p erform line segment neighb or nding queries and data structure up dates as the vertical line crosses appropriate features in the arrangement. Atanypoint in the algorithm, the sweep line will cross all of the n dual lines. Our data structure for a single slab (corresp onding to a single dual line arrangement) simply consists of an arrayofn elements, listing those lines in the vertical order of their p oints of intersection with the sweep line. Then a vertical ray sho oting query along the sweep line could b e p erformed by a binary search in the array, to lo cate the starting p oint among the dual lines. Successive queries would then take O (1) time by simply moving up to the next element in the array. The order of the dual lines changes exactly when the sweep line crosses an intersection b etween twodual lines. The change consists simply of swapping two adjacent elements in the array. The rays at whichwe wish to sho ot corresp ond to segments pq , which are also found as the intersection of two lines dual to p and q .Each successiveintersection can b e found in O (log n) time, bykeeping a priority queue of the n 1 p ossible intersections between adjacent elements in the array. Now let us consider putting several slabs together again. Starting eachray 2 sho oting query by binary searching in each slab separately would take O (log n) time p er segment. We can reduce this time, by using another data structure to relate lo cations in di erent slabs to each other. Recall that for each slab, corresp onding to an arrangementofsomem dual lines, there are two smaller slabs with m=2 dual lines each. The sweep line in the large slab is divided into m + 1 regions bythem lines crossing it. Each region in the large slab corresp onds to part of a region in each of the smaller slabs. Wekeep another array,ofm + 1 elements, listing the corresp ondence between regions of the large and small slabs. This corresp ondence only changes when an intersection o ccurs in the large slab; other intersections will rearrange the Nearest Neighb ors and Minimal Polytop es 19 corresp ondence of lines to regions but will not change the numb ering of the regions. For eachintersection of two lines, we only need to up date the corresp ondence for the region b etween the lines. Thus again each up date takes O (1) time p er slab. Nowwe can use these arrays to lo cate the p oint dual to each segment in the O (log n) slabs we wish to search. The p ointisanintersection in the outer slab containing all n points, and its lo cation will already b e known when the sweep line crosses that intersection. Then, while wehave a lo cation within a slab that contains p oints not ab oveorbelow the queried segment, weneedtomove to lo cations in the twochild slabs. This can b e done simply by lo oking in the appropriate arrays, in constanttimepermove. In this way it takes O (log n) time to nd the initial lo cations for ray sho oting in eachoftheO (log n) appropriate slabs. Once wehave found the initial lo cations for vertical ray sho oting, we can nd each successivevertical neighb or of the segment simply bymoving from element to adjacent element in the appropriate array. But wemust somehowcombine the neighb ors found in di erent slabs. To do this, we use a nal array, which tells us for each line the p osition of that line as it crosses the sweep line in the ro ot slab of all n p oints. This array is up dated as b efore byswapping two elements p er intersection encountered. Using this array,we can compare neighb ors from di erent slabs, by examining their p ositions in the sweep line. Eachvertical neighb or for the line segmentmust b e found by selecting among O (log n) candidates, one from each slab, each of which can b e thoughtofasaninteger having O (log n) bits, representing the p osition in the sweep line. This selection can b e p erformed in constant time p er op eration, using atomic heaps [23]. Theorem 7.1. Given n p oints, wecanenumerate all p oint sets found as the k nearest vertical neighb ors of each segment formed by a pair of p oints, in total time 2 2 O (n log n + kn ) and space O (n log n). Pro of: Eachintersection of two dual lines, causing a search from the corresp onding segmentaswell as up dates to the data structures, can b e selected in time O (log n) from a priority queue of p ossible intersections. Each searchfork nearest neighb ors takes time O (log n) to nd the initial p ositions for the ray sho oting, and O (1) time per neighb or found. Each up date takes constant time p er slab, and involves changes in O (log n) slabs (only those slabs containing b oth dual lines that intersect to cause 2 the up date). Therefore the total time for searches and up dates is O (n (log n + k )). Each dual line is involved in O (log n) slabs, and uses constant space p er slab, so the total space is O (n log n). 2 Remark. Again, since our algorithm uses atomic heaps, our time b ound holds only in the RAM mo del of computation. In the algebraic decision tree mo del, the time b ound increases by a factor of O (log log n). 20 D. Eppstein and J. Erickson Figure 2. Nearest neighb ors to p p : (a) vepoint set with triangle to furthest p oint; (b) L R seven nearest neighb ors havea ve-p oint subset in one parallelogram. 8 Minimizing Area Wenow describ e how to use the data structure of the previous section to nd k - p oint sets with minimum area convex hulls. The problem was previously solved by 3 2 Eppstein et al. [20] in time O (kn ) and space O (kn ). Lemma 8.1. If p and p are the leftmost and rightmost p oints of the minimum L R area k -p oint set, resp ectively, then every other p oint in the set is one of the 2k 4 nearest neighbors above or b elow the segment p p . L R Pro of: Let q b e the p oint farthest from p p in the optimal set. Then the area of L R the set is at least that of 4p qp . Consider the parallelogram with twovertical sides L R sides through p and p , one side equal to p p , and the remaining side parallel to L R L R p p and through q .We can divide this parallelogram vertically into two smaller L R parallelograms, each with area equal to that of 4p qp . If either parallelogram L R contains k points, they would supply a k -p oint set with smaller area. Thus, the large parallelogram containsatmost2k 2points, including p and p . 2 L R For example, Figure 2(a) shows a set of ve p oints, with 4p qp outlined. Fig- L R ure 2(b) shows 7 = 2 5 3points ab ove p p , ve of which are in one small L R parallelogram. This immediately gives us our algorithm for nding the minimum area k -p oint set. We simply examine each p ossible segment p p , and nd the 2k 4 neighb ors L R ab ove and b elow it. That gives us a set of 4k 6points, in whichwe can nd the 4 minimum k -p oint set in time O (k ) using the algorithm of Eppstein et al. [20]. Thus 2 4 2 weachieve a total time of O (n log n + k n ). 4 The O (k ) term in this b ound can b e improved. First note that the convex hull p , of the minimum k -p oint set is the union of the convex hulls ab ove and b elow p L R and the area of the convex hull is the sum of the areas ab ove and b elow p p . Each L R Nearest Neighb ors and Minimal Polytop es 21 of these twohulls must b e a minimum j -p oint set, among those sets containing b oth p and p , for j equal to the numb er of p oints in the resp ective sets. So if we can L R compute all minimum such j -p oint sets, for j top and b ottom sets in a further step taking time O (k ). In fact the algorithm of Eppstein et al. computes all these sets. Further, it works by trying all p ossible choices of the b ottommost p oint in the set; for each suchchoice the algorithm takes 3 O (k ) time. But in our situation we know the b ottommost p oint: it is either p L or p . Therefore we can compute the optimum k -p oint set among the neighb ors of R 3 segment p p in time O (k ). L R Theorem 8.1. We can nd the minimum area k -p oint subset of a set of n points 2 3 2 3 in the plane, in time O (n log n + k n ) and space O (n log n + k ). 2 p 3 This improves the previous time b ound of O (kn )[20] whenever k = O ( n ). 2 Our space b ound is always an improvementover the previous O (kn ) [20]. 9 Minimizing Volume and Boundary Measure In this section, we demonstrate a natural generalization of our minimum area algo- rithm to arbitrary dimensions. We also generalize our results for nding minimum p erimeter sets in the plane. d Let T be some r -dimensional p olytop e in IR , with r de ne the orthogonal distance from p to T to b e the Euclidean distance from p to 0 its orthogonal pro jection onto a (T ), whichwe denote p .Wecall p an orthogonal 0 neighbor of T if and only if p 2 T .We can compute the nearest orthogonal neighb ors to any p olytop e with xed complexity in linear time. d Given a set of p oints A in IR , and an arbitrary p oint p 2 A,we de ne the 0 series of extremal points, extremal simplices,and bounding boxes of A with resp ect to p , denoted p , S , and B ,respectively. While these sequences dep end on the 0 i i i initial p oint p , the prop erties wederive hold for all initial p oints. 0 We de ne B = S = p .For each1 i d, p is the p ointinA farthest from the 0 0 0 i ane hull of S . S =conv(S ;p ). B is the convex hull of twocopiesof B , i 1 i i 1 i i i 1 one containing p and one an equal distance from B in the opp osite direction, i i 1 situated so that B B , and adjacent facets of B meet at right angles. For any i 1 i i set A,wehave S (A) conv(A) B (A). See Figure 3 for an example. d d Volume and b oundary measure share the following prop erty. For some con- stant r , the minimum measure k -p oint set is contained in the m nearest orthogonal neighb ors to the b ounding b ox of its rst r extremal p oints (with resp ect to any p oint in the set). For measures with this prop erty,wehave the following algorithm outline for nding minimum measure sets. For eachsetofr points, there are r p ossible b ounding b oxes. For eachbox, we nd its m nearest orthogonal neighb ors, and search for the minimum measure set among them. 22 D. Eppstein and J. Erickson 3 Figure 3. Extremal p oints, extremal simplices, and b ounding b oxes in IR Lemma 9.1. Let b e a measure having the prop erty that the minimum measure k -p ointsetA is contained in the m nearest orthogonal neighb ors of B (A), and let r f (m) b e the time required to nd the optimal k -p oint set among m points. Then, d given a set of n p oints in IR ,we can nd the k -p oint subset minimizing , in time r +1 r O (n + n f (m)). 2 We know of no fully p olynomial time algorithm to nd minimum volume or b oundary measure sets, except in the plane [2,14,20]. A nave algorithm runs in