In this section, we show a zero-error randomized algorithm. We also derive a lower bound for the deterministic algorithms. This shows that zero-error randomized algorithms are more powerful than deterministic algorithms.
Definition 5.16. Let M be a metric space.
• LetS0 =q1, q2,· · ·, qn be a rearrangement of a sequence of points S =p1p2,· · ·, pn. A
point qi is called a still point if qi =pi.
• A functionf(x)→N can bec-approximated by a FZ[nr] computation algorithm if the
algorithm makes at mostnr queries, gives output with probability at least 23, and each outputy has cf(x)≤y ≤f(x).
• LetS0 =q1, q2,· · ·, qn be a rearrangement of a sequence of points S =p1p2,· · ·, pn. A
point qi in S0 is calledv-stable if qi =pj with |i−j| ≤v.
• LetS0 =q1, q2,· · ·, qn be a rearrangement of a sequence of points S =p1p2,· · ·, pn. S0
is called (u, v, α)-stable if for every u consecutive points set Q from S0, Q has at least
• For a sequenceS =q1q2· · ·qnof points inM, the sequenceS∗ = (q10, i1)(q20, i2)· · ·(q0n, in)
is called a marked sequence of S, where (q10, i1)(q02, i2)· · ·(qn0, in) is a permutation of
(q1,1)(q2,2)· · ·(qn, n). DefineE(S∗) = S.
• Let ΛM(c, m1, m2, r, m, n) be the set of all marked sequences (q1, a1)(q2, a2)· · ·(qn, an)
such that 1) S0 =q1q2· · ·qn is a permutation of a (t1, t2)-sequenceS =p1p2· · ·pn of n
points inM for some 0< t1 < t2 with t2
t1 ≤c; 2) everym1consecutive points inS
0 have
at least m2 points qi which are r-stable between S0 and S; 3) the diameter of S is at
least m·t1. and 4)(q1, a1)(q2, a1)· · ·(qn, an) is a permutation of (p1,1)(p2,2)· · ·(pn, n) • Let Γ be a class of marked sequences. A zero-error randomized (1−)-approximate
algorithmC with r(n) random bits for the diameter of sequence in Γ if for every input
S ∈Γ, we have 1) at least 34 paths of C has non-empty output; and 2) each non-empty output in a path is a (1−) approximation to diameter(S). Its time complexity and query complexity are defined similarly as that in Definition 5.1.
Theorem 5.17 shows a zero-error randomized algorithm to approximate the diameter of a marked sequence.
Theorem 5.17. Assume that M is a metric space with a (1−µ)-factor approximate algo- rithm AppM of time complexity C(k) for the diameter of k points in M for some nonde-
creasing function C(k) : N → N. Then for every constant ∈ (0,1), there exist positive constants β1, β2, and α < β1, and zero-error randomized (1 −)-approximate algorithm
such that given aΛM(c, β1m, αm, β2m, m, n)-sequence S0 = (q1, a1)· · ·(qn, an), the algorithm
makes at most O(mn log mn) non-adaptive queries to the items of S0 and outputs a number x
with (1−)(1−µ)·diameter(E(S0))≤x≤diameter(E(S0))in total time O(mn) +C(O(mn)), where m=o(n).
Proof: For a marked input sequence S0 = (q1, a1)· · ·(qn, an), let E(S0) be a permutation
of a (t1, t2)-sequenceS =p1p2· · ·pn with tt21 ≤c. A pointqi is called r-stable if it is r-stable
between E(S0) and S. The algorithm selects O(mn ) random points from E(S0) and puts thoser-stable points into the setQ. We show that diameter(Q) is close to the diameter ofS
with high probability. Select β1 andβ2 such that ((β1+ 1)c+β2)≤ 2. Letβ0 be a constant
such that β0
α >1. Our algorithm is described as follows:
Algorithm
Input: A Λ(c, β1m, αm, β2m, m, n)-sequence S0 = (q1, a1)(q2, a2)· · ·(qn, an).
Output: an approximation x to diameter(q1q2· · ·qn).
letw=β0mn logmn;
select w items (qi, ai) from S0 randomly
for i= 1 to w
if |ai−i| ≤β2m then put qi into set Q;
output x=AP PM(Q);
End of Algorithm
AssumeS0 = (q1, a1)(q2, a2)· · ·(qn, an). Selectw=β0mn log mn tuples (qi, ai) randomly
fromS0 and put qi into the set Qif |ai−i| ≤β2m. Assume that dist(qi1, qj1) is the diameter
inE(S0) andβ1m≤ |Qi| ≤β1m+ 1. We havek ≤ βn
1m. Assume thatqi1 ∈Qi
0 and qj
1 ∈Qj0.
Since each Qi contains at least β1m points, eachQi contains at leastαm β2m-stable points.
With probability at most
(1−(αm n )) w = (1−(αm n )) (αnm)β0 α log n m ≤(1 2) β0 α log n m ≤(m n) β0 α, (5.20)
no β2m-stable point is selected in Qi. With probability at most k(1−(αmn ))w ≤ k(mn)
β0
α =
o(1), Q does not contain anyβ2m-stable point qi marked with |ai−i| ≤β2m inQi for some
i with 1≤i≤k.
With probability at least 1−o(1), some β2m-stable points qi marked with |ai−i| ≤
β2m from both Qi0 and Qj0 will be selected. Check if each interval has marked β2m-stable
points. With probability at least 1−o(1), each Qi has β2m-stable point qi marked with |ai−i| ≤β2mselected. Assume thatqi00is a β2m-stable point inQi,qj00 is aβ2m-stable point
in Qj0, and both qi00 and qj00 are in Q. The distance betweenqi
1 and qi00 is at most β1mt2 ≤ β1m·ct1 ≤ 2mt1 ≤ 2dist(qi1, qj1). Similarly, we have dist(qj1, qj00)≤
2m≤
2dist(qi1, qj1). By
the triangle inequality in a metric space, we have dist(qi00, qj00)≥dist(qi
1, qj1)−dist(qi1, qi00)−
dist(qj1, qj00) ≥ dist(qi1, qj1)−
2dist(qi1, qj1)−
2dist(qi1, qj1) = (1−)dist(qi1, qj1). When a
path selects at least one β2m-stable point from each Qi and puts it into Q, the path gives
(1−)-approximation for the diameter.
We have the following theorem to separate the sublinear time zero-error randomized computations from sublinear time deterministic computations.
Theorem 5.18. Assume that c is a positive constant, is a constant in (0,1), β is a con- stant in (0, c), and m = o(n). Then there is no deterministic algorithm such that given a
ΛR1(1, cm, βm,0, m, n)-sequence S0 it makes o(n) adaptive queries to the input and outputs
a (1−) approximation to the diameter of E(S0).
Proof: See appendix section A.3.