Model
- RAM
- operations
on reals, including sqrts.
- (why
OK)
- line
segment intersections
- DISCRETE
randomization
Applications:
- graphics
of course
- any
domain where few variables, many constraints
setup:
- n lines in plane
- gives O(n2) convex regions
- goal:
given point, find containing region.
- for
convenience, use triangulated T(L)
- triangulation
introduces O(n2) segments (planar graph)
- assume
all inside a bounding triangle
how about a binary space partition?
- single
line splits input into two groups of n-1 rays
- search
time (depth) could be n
A good algorithm:
- choose
r random lines R,
triangulate
- inside
each triangle, some lines.
- good if each triangle has only an(log r)/r lines in it
- will
show good with prob. 1/2
- recurse
in each triangle--halves lines
Lookup method: O(log n) time.
Proof of good
- As
with cut sampling, consider individual ``problem'' events, show unlikely
- Let
be all triplets of L-intersections
- when


is bad:
- let I(
) be number of lines
hitting 
- let G(
) be lines that induce
(at most 6)
- for
bad
, must have all lines of G(
) in R
(call this B1(
)), no lines of I(
) in R
(call this B2(
).
- bound
prob. of bad
:
Pr[
]
Pr[B1(
)]Pr[B2(
) | B1(
)]
(why not equal?)
- Given
B1(
), still need r - | G(
)|
r - 6
r/2 drawings (assuming r > 12)
- prob.
none picked is at most
(1
-
)r/2
e-rI(
)/2n
- Only
care if I(
) > an(log r)/r--large
triplets
- Pr[B2(
) | B1(
)]
r-a/2 for large triplet
- prob.
some bad at most
r-a/2
Pr[B1(
)]
- sum is
expected number of large triplets.
- at
most r2
points in sample
- at
most (r2)3
= r6 triplets in sample
- expectation
at most r6
- choose
a > 12, deduce
result.
Construction time:
T(n)
n2 + cr2T(an
) = O(n2 +
(r))
decreasing with r
- by
choosing large r, arbitrarily close to O(n2)
Special sampling idea:
- Sample
all except one item
- hope
final addition makes small or no change
Method:
- process
items in order
- average
case analysis
- randomize
order to achieve average case
- e.g.
binary tree for sorting
Randomized incremental sorting
- Less
data structure than binary tree
- repeated
insert of item into so-far-sorted
- each
yet-uninserted item points to ``destination interval'' in current
partition
- bidirectional
pointers (interval points back to all contained items)
- when
insert x to I,
- splits
interval I
- must
update all I-pointers to one of two new
intervals
- finding
easy easy (since back pointers)
- work
proportional to size of I
- If
analyze insertions, bigger intervals more likely to update; lots of
quadratic terms.
Backwards analysis
- run
algorithm backwards
- at
each step, choose random element to un-insert
- find
expected work
- works
because:
- condition
on what first i objects are
- which
is ith
is random
- discover
didn't actually matter what first i items
are.
Apply analysis to Sorting:
- at
step i, delete random of i
sorted elements
- un-update
pointers in adjacent intervals
- each
pointer has 2/i chance of being un-updated
- expected
work O(n/i).
- true whichever
are i elements.
- sum
over i, get O(n log n)
- compare
to trouble analyzing insertion
- large
intervals more likely to get new insertion
- for
some prefixes, must do n
- i updates at step i.