Lecture Notes
CMSC 251
In summary, there is no one way to solve a summation. However, there are many tricks that can be
applied to either ﬁnd asymptotic approximations or to get the exact solution. The ultimate goal is to
come up with a close-form solution. This is not always easy or even possible, but for our purposes
asymptotic bounds will usually be good enough.
Lecture 4: 2-d Maxima Revisited and Asymptotics
(Thursday, Feb 5, 1998)
Read:
Chapts. 2 and 3 in CLR.
2-dimensional Maxima Revisited:
Recall the max-dominance problem from the previous lectures. A point
p
is said to
dominated by
point
q
if
p.x
≤
q.x
and
p.y
≤
q.y
. Given a set of
n
points,
P
=
{
p
1
,p
2
,...,p
n
}
in 2-space a point is said to be
maximal
if it is not dominated by any other point
in
P
. The problem is to output all the maximal points of
P
.
So far we have introduced a simple brute-force algorithm that ran in
Θ(
n
2
)
time, which operated by
comparing all pairs of points. The question we consider today is whether there is an approach that is
signiﬁcantly better?
The problem with the brute-force algorithm is that uses no intelligence in pruning out decisions. For
example, once we know that a point
p
i
is dominated by another point
p
j
, then we we do not need to use
p
i
for eliminating other points. Any point that
p
i
dominates will also be dominated by
p
j
. (This follows
from the fact that the domination relation is
transitive
, which can easily be veriﬁed.) This observation
by itself, does not lead to a signiﬁcantly faster algorithm though. For example, if all the points are
maximal, which can certainly happen, then this optimization saves us nothing.
Plane-sweep Algorithm:
The question is whether we can make an signiﬁcant improvement in the running
time? Here is an idea for how we might do it. We will sweep a vertical line across the plane from left
to right. As we sweep this line, we will build a structure holding the maximal points lying to the left of
the sweep line. When the sweep line reaches the rightmost point of
P
, then we will have constructed
the complete set of maxima. This approach of solving geometric problems by sweeping a line across
the plane is called
plane sweep
.
Although we would like to think of this as a continuous process, we need some way to perform the
plane sweep in discrete steps. To do this, we will begin by sorting the points in increasing order of
their
x
-coordinates. For simplicity, let us assume that no two points have the same
y
-coordinate. (This
limiting assumption is actually easy to overcome, but it is good to work with the simpler version, and
save the messy details for the actual implementation.) Then we will advance the sweep-line from point
to point in
n
discrete steps. As we encounter each new point, we will update the current list of maximal
points.