Volume *, nurrtir * INFORMATION
PRCXXSSINGLWi ERS February1978
DIVIDE AND CONQUER FOR LLYEAREMECFED TIME *
Jon Louis BENTLEY and Michael Ian SHAMOS
LWmento of clomputer sclsnce undMht#wm@ics,C aaqk-Rfellon University, Pittsbcqgh, PA 1.5213, U&A.
Received 29 Match 1977; revisedversion received 17 Octuber 1977
Avcragscasc analysis, computational geometry, convex hull, divide-and-conqLer,
expected time, line= programming,
rand6mJets
1. Introduction and thus takes advantage of the fact that h may be
smah. Unfortunately, if k is not known in advance,
Divide-and-conqueris one of the most frequently the algorithm may take quadratic time. Eddy [2] has
used methods for the design or fast algorithms. The developed a hull algorithm analogous to QUKX ORT
most common application of the technique involves that has good empirical performance but atso has a
breaking a problem of size N into two subproblems of quadratic worst case. * In this paper we use informa-
size N/2, solving these subproblems, then doing work tion about the probability distribution of h to obtain
proportional to N to marry the partial answers into an algorithm with O(N) expected running time with-
a solution for the entire problem; this scheme leads to out sacrificing O(N log N) worst-case behavior.
This new convex hull algorithm leads to tinear
algorithms of O(N log N) worstsasc time complexity.
In this paper we investigate a similar divide-and-con- expected-time solutions to a host of other geometry
quer technique which can be used to construct algo- problems that are related to hull-finding. Among these
are determining the greatest distance between two
rithms with linear average-casetime complexity.
points of a set, the smallest circle enclosing a set, ild
The problem of determining the convex hull of a
set of points in two and three dimensions has pro- constructing linear pattern classifiers. Analogous
techniques yield a linear average-case algorithm for
duced a rash of recent papers [4,8,15,16], all con-
linear programming in two variables.
taining algorithms with o(N logA!) worst-case per-
The divide-and-conquer scheme we use to achieve
formance. That this is optimal follows from the fact
the above results seems to be a general method suitable,
that in the worst case all N points may be vertices of
for the construction of fast average-case algorithms,
the convex hull, and since the vertices of a convex
It achieves fast expected time at the cost of making
palygon occur in sorted angular order about each
only relatively weak assumptions about the under-
interior point, any convex hull dgorit.?m ust be
m
lying probabifity distribution of the inputs. Whereas
able to sort [ 14,8] e If the boundary of the convex
many fast average-case algorithms display poor worst-
hull contains very few points, however, this lower
case behavior (QUICK:SORT, for example; see [ 13]),
bound does not apply, and a faster algorithm ma:{ be
those that we give in this paper have optimal worst-
possible. The algorithm of Jarvis [S] runs in time
case performance. These algorithms sre not merely
Q&N), where it is the number of actual hull vertices,
of asymptoiic interest - they are faster than previous
methods even for very small problem sizes (IV> 40,
* This researchwas supportedin part by the Office of Naval
for example).
Re~~ch under Contract NOM3l4~76-C-0829.
1 R.W.Floyd is able to show that E,ddy sdg6rithm runs in in reading this paper, one must be very careful to
linear expected time for cert% symmetricdistributions keep in mind the distinrtion between worst-case and
(personalcommunication).
87
murapcm andyaw. For emmpb,whiIeany camx
huiIdgwithmmustrunintimeS&N~N)foraome
ldlgkm~thmwithlilKtuaxpecdsd
*A=
nutninatime(for some d&tribution ofinputs).Notim
tlut there ir no contmdkdon betwean 8 wontsue
lowetboundofSZQW~A )8nd8n8ve~upper
boundd0#.
B8sic realIt8from stochlrtic geometry am daabod
inSection2;thcsaresulbformthebrrbofourp+a.
bilistic wlysis of the 8lgorithmapre8ented. In Sw
tion 3 we give 8 fast expected-time 8@&thm for
findiryconwhulbInthepl8wndinvut&teb
d&8ilthW&Jln8U8lIdlf0h4A@hm.SOCdon4
ahow8howthismethodc8nbe8pplIedtootherprob=
lean8md wed IS 8 bullding block for developing 8ddk
tionrl fast expected-time algorithms.Sect&ma cuak
5
t8ins su*ticns for further work 8lq the38 line&
stoch8atic @wmary e& with the propartia of
d
mndcxnsets of p&ts, lines urd other mtric ob.
jectsurdirmeasentWoolforMJydnlthe8ve~
c8se of guomehic 8lgorithm&M8ny phenomenr in
g8ometlic8l prob8bility M counter-intuitivd 8nd dir*
&Uh to explrin Without ti took Ofpmb8buhtrc
mea theory. For tutam*, the strtement, Clmom
~pdnh8rr8ndomintheplura,bme8ninlkr,
without 8 predw sp8ciflc8tion ofdistribution from
which the points ~IUto be chosen. Furthermom, not
rU conceiv8ble distributions utisfy the axiomsof
probrbility. Points c8n be choa8n unifomdyin the
@n43 nly from 8 Mt OfbOUItd8d
O Ldb88@BC mduw6
[6 ], So the ilktUitiVC&
8ttnctiVe not&onOf 8 uniform
mndom selection from the whole plum must be dis
CudHI.
The problem of determ~&Q3), the expected
number of wrtica of the cawex hull of N pdntr,
hW@UJiWd8lpoddWiOf8ttenti~ [1$,9,11);8
8Umm8ryofthisworltm8ybefoundin[I2).Wenow
quoteaever8ire8&8th8twiubeumdl8terh8n8lyB
fnlour~thms:
Fubruary 1978
asthe originaL The nsult of each of the recursive
Notethr 8 wtcx of tke OQ~BW.uil cf a iJni&
h
calls is a convex polygon whose expected number o
&&nerIr anti set ir m&Am& f@l suw assipmnt of
OfI! points. wztkcs is O(No), w&h p
piur8llb dw8~ttorll~~&utiec
set is now just the hti of the union of the hulls found
TMa implica that fw diat? butio~ trt&wng the Me-
in the subproblems. Shames [ 1S] has given an a&
p@nW ~rs~ption of J Morem4, &hocxpcctcd
rfthm to find the hull Gf the union of two convex
m&et of vertices of tba convex hull ;ubounded by
polygons in tkt prop1 tionel to the total number of
.
IF@) ;
tite points is rcgif_sent ;_d a pair of in*>:gcrs
as which
f~exarn~ ! .iiN
true,wemayhave~Q)1=c);-kj
define the left an ;I right endpoints of a ~gmcna of
pointsare~tedunifomLh~o.~ trekut -/ofa
the array. Dlvisicv into further subs& :.A PCsccom-
circle, then rcgv) - fv. As we & k *.; irl the next
plishctdby taking the arithmetic mean ^the crtd-
sectioa, the onJyxsumption A. Jut ?hcdirtnbution
points as deftnmg two new segments, e 2.; note that
of p&u &at needr to be made i.u o. :Icr to obtain a
the division preserves randomless. In i;.~ple~ncr ting
linexr expected-t&neelgorithm is that I::J) = Q(P),
this 3lgorithm recursively, it,z;crucial 1.) pas 0; tly
forsomepn,The convex huIl of a random set of points,
independently and at random to meet Ke but not Kt,
Biometrika52 (1965) 331-344.
and we define Hi to be the closed half-plane bounded
141 R.L. Graham,An efficient algorithmfor determining
by Lt that contains Kr, consider E(u), the expected the convex huIIof a planarset, Information Processing
number of vertices of the intersection of all the Hi. Lett. I (1972) 132-133.
Preliminary results were obtained by Renyi and R.A.. Jarvis, On the identification of the convex hull of
a fbrite set of points in the plane, Information Pro-
Sulanke (lo] and Ziezold 1181 has shown by duality
cessing Lett. 2 (1973) 18-21.
that E(u) is of the same asymptotic order as the ex-
[62 M.G. Kendall and P.A.P. Moran, Geometrical Probability,
pected number of points on the hull of a set of N Griffin (1963) 125 pp.
points drawn uniformly within Kr. If K1 shrinks to a f71H.T. K&g, M. Schkomick and C.D. Thompson, On the
point, then E(u) approaches the constant n2/2. In any average number of maxima in a set of ve.ctors, submitted
for publication.
event, under fairly conservative assumptions we will
VI F.P. Prqarata and S.J. Hong, Convex hulls of tlnite
have E(u) = O(w), p