day5 1/26/98 Quote of the day: ``Just leave it out.''

1.  Linear Programming

The constraints can be divided into 3 sets:

In general only 2 of the constraints in H0 can be active at one time.

Define:

By looking at the slopes of lt+ and lt- you can decide whether the solution must lie to the left or to the right.

1.1  Algorithm

This algorithm is dual to the bridge finding algorithm in the convex hull problem. Start with a window(a,b) in which the solution must lie.

  1. Pair up lines in H+ , Pair up lines in H- .
  2. compute » n/2 intersections
  3. pick t = median x value from the intersections. Let lt- = the smallest y-value which any solution must lie below and lt+ = the largest y value which any solution must lie above.
  4. case 1: lt- > lt+ (there exists a feasible region) if slope( lt+ )=0 then you are done, else if slope( lt+ )>0, pick window(a,t) else pick window(t,b)
  5. case 2: lt- < lt+ if slope(lt+)-slope(lt-) > 0 then pick window(t,b) else pick window(a,t).
  6. case 3: : lt- = lt+ degenerate nastiness.
  7. For each pair with an intersection outside the new window discard a constraint.
  8. repeat with new window and remaining constraints.

1.2  Timing:

Timing is the same as the bridge algorithm.

T(n) = T(3/4*n)+c*n

2.  Amortized analysis

2.1  Binary counter

How many bits change on average?

To figure out the total cost, do (å[^(costi)]+#Cbegin-#Cend)/n = amortized cost. The amortized cost for a the binary counter is 2. One way to see this is to notice that when the counter is updated there is a p = 1 chance of 1 bit changing, a p = 1/2 chance of another bit changing, a p = 1/4 chance of another bit changing.... the series sums to 2.

2.2  Splay trees

2.2.1 binary search trees

Common to all ordered trees

The important method of transforming a binary tree is rotation of a child to a parent. Splay trees rotate any element looked at to the top of the tree.


File translated from TEX by TTH, version 1.30.