1/19/98 - day 3

1.  Merge Convex hull

  1. Sort P1,...,Pn by the X value

  1. H1 = MCE( P1,...,Pn/2 ), H2 = MCE( Pn/2+1,...,Pn )

  2. Merge Hull( H1,H2 )

1.1  Upper Hull and Lower Hull

The convex hull algorithm can be built to find the upper hull and the lower hull then the upper and lower hulls can be easily integrated.

1.2  Upper Merge Hull

Merge upper hull( H1,H2 ) = start with the inner (x value near the median point) points, throwing out those with a y value lower than the maximum.

1.3  Timing analysis

T(n) = 2T(n/2)+c(h1+h2) which implies T(n) = O(nlg(n))

2.  Quick Hull

QUH( l,P = {P1,...,Pn},r ) =

  1. find highest point (large y value) m from line (l,r)

  2. remove all points below line (l,r)

  3. QUH( l,P,m ),QUH( m,P,r )

2.1  Worst case

The worse case is when every point is on an upper semicircle, causing the time equation

T(n) = T(n-1)+cn which means T(n) = W(cn2)

2.2  average case

The average case is points distributed uniformly throughout a semicircle. It will have time complexity of about: T(n) = T(n1)+T(n2)+cn for n1+n2 £ an with a < 1 .

3.  The ultimate 2d convex hull

Assume we have a O(n) time median algorithm.

Upper Hull( l,P,r )

  1. using median partition P into PL,PR based on the x value

  2. Find Bridge b = (a,b) in upper hull from PL,PR

  3. Remove points below the line segments defined by (l,a,b,r) from PL,PR

  4. return Upper Hull( l,PL,a ), Upper Hull( b,PR,r )

3.1  Timing

let h = # edges on hull

The time complexity is c*n*lg2(h) .

Check this by plugging it into the time complexity equation.

T(n,h) = T(n/2,h1)+T(n/2,h2)+cn £ c*n/2*(lg2h1+lg2h2)+c*n

£ c*n/2*lg2(h2/4)+cn = c*n*lg2(n)

3.2  finding the bridge

  1. form n/2 pars of points from P and compute their slopes.

  2. Find median slope, S.

  3. Find support line, SL, with slope S.

  4. If SL too steep, throw out left point from each pair s.t. the slope greater than S, recurse.

  5. Else, if SL too shallow, throw out right point from each pair s.t. the slope < S, recurse.

  6. Else if SL has the ``right'' slope you are done

3.2.1 Timing analysis

n/4 points will be thrown out in each recursion.

T(n) = T(3/4*n)+cn which has solution: T(n) = 4cn


File translated from TEX by TTH, version 1.30.