CS174 Spring 99 Lecture 3 Summary

Partial Order in Permutations

What's the probability that 4 comes before 5 in the output permutation? Tempting to say ½, but why?

For every permutation where 4 is before 5, there is a matching permutation where 5 is before 4 obtained by swapping. That's a 1-1 correspondence between the two sets of permutations, so they must have the same size, and partition the set of all permutations into two halves. What's the probability that an element u comes before i values v1,...,vi ?

By similar argument, we partition the set of all permutations according to the ordering of u,v1,...,vi. So it's enough to answer this question just for those elements. If u comes first in a permutation of u,v1,...,vi, then there are i! ways to order the v's, while there are (i+1)! permutations total. So the probability that u is first is

i!/(i+1)! = 1/(i+1)

Binary Planar Partitions

The problem is to divide up a set of line segments with a new set of lines (as per figure 1.2 in MR).

Painting:

The binary planar partition can be used to "paint" the set of line segments that a viewer might see from some point in the plane. For each node (partition line) in the tree, we determine which side of the partition is further from the viewer, and paint that subtree first. Then we paint the closer subtree. This ordering guarantees that all line segments are painted in back-to-front order, and so no visible edge gets painted over.

The time to paint is linear in the size of the partition. So the goal is to construct a small partition.

We consider auto-partitions where the partitioning lines are extensions of the input line segments.

Simulation of algorithm RandAuto from MR.

Must work eventually because all the extended lines gives a good partition (but it has size W(n2))

Explanation of index(u,v)

Explanation of u cuts v

Cu,v is an "indicator variable" which is 1 if u cuts v. This type of variable is used again and again in probabilistic algorithms.

E[Cu,v] = Pr[u cuts v] £ 1/(index(u,v)+1)

The total expected partition size is n + E[å u å v Cu,v] £ n + åu   åv 1/(index(u,v)+1)

For i = 1,...,n there are at most two segments v such that index(u,v) = i, so

å v 1/(index(u,v)+1) £ å i=1..n 2/(i+1) £ 2Hn

where Hn is the nth Harmonic number, and is roughly ln n.

Substituting back for total partition size, it's bounded by

n + å u 2Hn £ n + 2n Hn which is O(n log n)

Note that we have shown that a partition of size O(n log n) exists, by showing that the algorithm has probability > 0 of finding it.