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
Backwards analysis
- compute
expected time to insert Si - 1
Si
- backwards:
time to delete Si
Si - 1
- conditions
on Si
- but
generally analysis doesn't care what Si is.
Define
- assume
no 3 points on straight line.
- output:
- points
and edges on hull
- in
counterclockwise order
- can
leave out edges by hacking implementation
(n
log n) lower bound via sorting
algorithm (RIC):
- random
order pi
- insert
one at a time (to get Si)
- update
conv(Si - 1)
conv(Si)
- new
point stretches convex hull
- remove
new non-hull points
- revise
hull structure
Data structure:
- point
p0
inside hull (how find?)
- for
each p, edge of conv(Si)
hit by

- say p cuts this edge
- To
update pi
in conv(Si - 1):
- if pi inside,
discard
- delete
new non hull vertices and edges
- 2 vertices v1, v2
of conv(Si - 1)
become pi-neighbors
- other
vertices unchanged.
- To
implement:
- detect
changes by moving out from edge cut by
.
- for
each hull edge deleted, must update cut-pointers to
or 
Runtime analysis
- deletion
cost of edges:
- charge
to creation cost
- 2
edges created per step
- total
work O(n)
- pointer
update cost
- proportional
to number of pointers crossing a deleted cut edge
- BACKWARDS
analysis
- run
backwards
- delete
random point of Si
(not conv(Si))
to get Si - 1
- same
number of pointers updated
- expected
number O(n/i)
- what
Pr[update p]?
- Pr[delete cut edge of p]
- Pr[delete endpoint edge of p]
- 2/i
- deduce
O(n log n) runtime
· Book
studies 3d convex hull using same idea, time O(n log n), also gets
voronoi diagram and Delauney triangulations.
Motivation:
- manipulate/analayze
a collection of segments
- e.g.
detect segment intersections
- e.g.,
point location data structure
- Draw
verticals at all points
- binary
search for slab
- binary
search inside slab
- problem:
O(n2) space
Definition.
- draw
altitudes from each intersection till hit a segment.
- trapezoid
graph is planar (no crossing edges)
- each
trapezoid is a face
- show a
face.
- one
face may have many vertices (from altitudes that hit the outside
of the face)
- max
vertex degree is 6 (assuming nondegeneracy)
- so
total space O(n + k) for k intersections.
- number
of faces also O(n + k) (each face needs
one edge)
- (or
use Euler's theorem: nv - ne + nf
2)
- standard
clockwise pointer representation lets you walk around a face
Randomized incremental construction:
- to
insert segment, start at left endpoint
- draw
altitudes from left end (splits a trapezoid)
- traverse
segment to right endpoint, adding altitudes whenever intersect
- traverse
again, erasing (half of) altitudes cut by segment
Implementation
- clockwise
ordering of neighbors allows traversal of a face in time proportional to
number of vertices
- for
each face, keep a (bidirectional) pointer to all not-yet-inserted
left-endpoints in face
- to
insert line, start at face containing left endpoint
- traverse
face to see where leave it
- create
intersection,
- update
face (new altitude splits in half)
- update
left-end pointers
- segment
cuts some altititudes: destroy half
- removing
altitude merges faces
- update
left-end pointers
Analysis:
- Overall,
update left-end-pointers in faces neighboring new line
- time
to insert s is
(n(f )+
(f ))
where
- F(s) is faces s bounds
after insertion
- n(f ) is number of vertices in face f
(f
) is number of left-ends in f.
- So if
Si is
first i segmenets inserted, expected work
of insertion i is


(n(f )+
(f ))
- Note
each f appears at most 4 times in sum
- so O(

(n(f )+
(f ))).
- Bound
endpoint contribution:
- note
l (f )= n - i
- so
contributes n/i
- so
total O(n log n)
- Bound
intersection contribution
n(f ) is O(ki + i) if ki
intersections
- so
cost is E[ki]
- intersection
present if both segments in first i
insertions
- so
expected cost is O((i2/n2)k)
- so
cost contribution (i/n2)k
- sum
over i, get O(k)
- note: adding to RIC, assumption that first i items are random.
- Total:
O(n log n + k)