change from book. List L
- idea; random
sampling
- median
of sample looks like median of whole. neighborhood.
- Algorithm
- choose
s samples with replacement
- take
fences before and after sample median
- keep
items between fences. sort.
- Analysis
- claim
(i) median within fences and (ii) few items between fences.
- Without
loss of generality, L contains 1,..., n.
- Samples
s1,..., sm in sorted order.
- lemma:
Sr near
rn/s.
- Chernoff:
k,
number elements before k is (1±
)ks/n, where
=
.
- Thus,
when k > n/4, error ks/n(1±
) = ks/n(1±
).
- S(1 +
)ks/n > k
- Sr > rn/s(1 +
)
- Sr < rn/s(1 -
).
- Let r0 =
(1 -
)
- Then
w.h.p.,
(1 -
)/(1 +
) < Sr0 < n/2
- Let r1 =
(1 -
)
- Then
Sr1 > n/2
- But Sr1 - Sr0 = O(
n)
- Number
of elements to sort: s
- Set
containing median: O(
n) =
O(n
).
- balance:
(n2/3)
in both steps.
Randomized is strictly better:
- Optimum
deterministic:
(2 +
)n
- Optimum
randomized:
(3/2)n + o(n)
- synchronous
message passing
- bidirectional
links, one message per step
- queues
on links
- permutation routing
- oblivious
algorithms only consider self packet.
- Theorem Any deterministic oblivious permutation
routing requires
(
) steps on an N node degree d
machine.
- reason:
some edge has lots of paths through it.
- homework: special case
- Hypercube.
- N nodes, n = log2N
dimensions
- bit
representation
- natural
routing: bit fixing (left to right)
- paths
of length n
- Nn edges for N
length n paths
- lower
bound n
- Routing
algorithms:
- O(n) = O(log N) randomized
- beats
(
) deterministic
- how?
load balance paths.
- Random
destination (not permutation!), bit correction
- Average
case, but a good start.
- T(ei) = number of paths using ei
- by
symmetry, all E[T(ei)] equal
- expected
path length n/2
- LOE:
expected total path length Nn/2
- nN edges in hypercube
- E[T(ei)] = 1/2
- Chernoff:
every edge gets
3n
(prob 1 - 1/N)
- Naive
usage:
- n phases, one per bit
- 3n time per phase
- O(n2) total
- From
intermediate destination, route back!
- routes
worst case permutation in O(n2).
- What
if don't wait for next phase?
- FIFO
queuing
- total
time is length plus delay
- Expected
delay
E[
T(el)] = n/2.
- Chernoff
bound? no. dependence of T(ei).
- High
prob. bound:
- consider
paths sharing route (e0,..., ek)
- Suppose
S packets intersect route (use at least
one of ei)
- claim
delay
| S|
- Suppose
true: Let Hij
= 1 if j hits i's
(fixed) route.
|
E[| S|]
|
=
|
E[ Hij]
|
|
|
|

|
E[ T(el)]
|
|
|
|

|
n/2
|
|
- Now
Chernoff does apply (Hij
independent for fixed i-route).
- | S| = O(n) w.p. 1 - 2-5n, so O(n) delay for all 2n paths.
- Lag
argument
- Exercise:
once packets separate, don't rejoin
- Route
for i
= (e1,..., ek)
- charge
each delay to a departure of a packet from
.
- Packet
waiting to follow ej
at time t has: Lag t - j
- Delay
of vi
is lag crossing ek
- When
vi
delay rises to l + 1,
some packet from S has lag l (since crosses ej instead of vi).
- Consider
last time t' where a lag-l
packet exists
- some
lag-l packet w
crosses ej'
at t' (others increase to lag-(l + 1))
- w leaves at this point (if not, then l at ej' + 1 next time)
- charge
one delay to w.