m
n. The recurrence equation
in T(n) implies that T(n)
O(n2). That is, the program is of O(n2) time
complexity.
Find a probabilistic variation of the program that has O(n log n) expected time complexity.
Hint: A proof by induction can be used to show that T(n) = O(n log n) if
T(n)
cn + 2/n
i=0n-1 T(i).
C for
matrices. Consider the following algorithm.
C holds if d1
d2. Otherwise,
declare that AB = C.
+ aN-1x + aN . A brute-force algorithm for deciding the
equality p(x)
q(x) = t(x) takes O(N2) time under the uniform cost criteria, if
p(x), q(x), and t(x) are univariate polynomials of degree N, at most, and the
coefficients are natural numbers. Show that a probabilistic program can decide the
problem in O(N) time, with an error probability smaller than some constant
< 1/2.
Hint: Note that a univariate polynomial s(x) of degree N has at most N roots, that is, N values x0 such that s(x0) = 0.
1, . . . ,
m) that satisfy
1
1, . . . ,
m
N, if N
cd and c
1.
0 }.
+ dmvm = 0 with
probability no greater than 1/r.
amb1 | m
0 } is accepted by a
bounded-error probabilistic pushdown automaton.
Hint: Use part (a) of the problem to check that the inputs have the form
ai1bj1ai2bj2
aimbjm with i2 - i1 - 1 = 0, i3 - i2 - 1 = 0, . . . and
j1 - j2 - 1 = 0, j2 - j3 - 1 = 0, . . .
Hint: Allow M2 to halt in a rejecting configuration with probability (1/2)n and to start a new simulation of M1 with probability 1 - (1/2)n, after simulating a nonaccepting computation of M1.