

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Discrete Structures Randomized Algorithm Exercises Exam Paper
Typology: Exercises
1 / 3
This page cannot be seen from the preview
Don't miss anything!


The expected number of bits where the two Bloom filters differ is n times the probability that a fixed bit differs; call this pb. If one of the r common elements gets mapped to the bit through one of the k hash functions, this bit will obviously be the same. The probability that this happens is pc = 1 − (1 − (^1) n )rk. Now condition on none of the r common elements setting the bit. The probability that one of the m − r elements unique to the first set makes this bit one is pd = 1 − (1 − (^) n^1 )(m−r)k. The second set also have m − r unique elements, so it has an independent probability of pd that one of these elements sets the bit (the probabilities are independent because the elements are unique to each set). The probability that exactly one of the sets make the bit one is 2pd(1 − pd). This is all conditioned on none of the common elements setting the bit, so overall pb = (1−pc)2pd(1−pd) = (1− (^1) n )rk 2 ·(1− (^) n^1 )(m−r)k(1−(1− (^1) n )(m−r)k) = 2(1− (^) n^1 )mk(1−(1− (^) n^1 )(m−r)k). The expected number of differences is then npb. We can get bounds on the deviation using the Poisson paradigm. Using this to estimate r is a matter of statistics and it’s a bit different. We need to have some assumption on the distribution of r. Then, we determine an empirical p̂b, and from this we can perform a maximum likelihood estimation of ̂r. How good this estimate is depends on the assumed distribution of r and the value of r that we see (of course, we can’t hope to reliably estimate a very small r, except with a linear number of trials). I believe that for an assumed uniform distribution on r and using the bound via the Poisson paradigm, we can approximate (^) nr within an additive ε with constant probability, but I didn’t check all calculations.
We associate with each tree a polynomial, defined recursively as follows. For leaves, the polynomial is x 0. If the tree has height h ≥ 1, the polynomial is (xh − Pv 1 )... (xh − Pvk ), where v 1 ,... , vk are the children of the root, and Pvi is the polynomial associated with the subtree rooted at vi. We now argue that the polynomials associated with two trees are symbolically equal iff the trees are isomorphic. This is shown by induction on the heigh of the tree. It is obvious for h = 0 (leaves are always isomorphic, and x 0 = x 0 ). Now consider two trees of height h. If the trees are isomorphic, there is a bijection between the children of the roots, such that the subtrees are isomorphic. The two polynomials are products of terms corresponding to the subtrees; if the subtrees are isomorphic by some association, they will have equal polynomials, so the product will also be the same (it is commutative, so the association between the subtrees is irrelevant). Also, we use xh for both trees, because if they are isomorphic, they must have the same height. Now assume the polynomials are symbolically equal. For this, it must be the case that the trees have the same height, because the polynomials must have the same maximum i such that xi appears in the polynomial. Now, the maximum degree of xh is the number of children; thus, the two roots must have the same number of children k. Because both polynomials come from trees of height h, with roots having k children, they can be written as (xh − Pv 1 )... (xh − Pvk ) = (xh − Pu 1 )... (xh − Puk ). The polynomials can be viewed as polynomials in one indeterminate xh, with coefficients coming from the ring R = K[x 1 ,... , xh− 1 ]. Then, Pvi are the roots of the first polynomial, and Pui are the roots of the second polynomial. Since R[xh] is a unique factorization domain, the roots of two equal polynomials must be equal. So there is some association
between {vi} and {ui} which makes the polynomials Pui and Pvj symbolically equal. These polynomials characterize trees of heigh h − 1 so by induction, the tress are isomorphic. But if we can group the subtrees in isomorphic pairs, the big trees are also isomorphic, qed. Now all we have to do is test that the two polynomials are symbolically equal. Note that they have degree h + 1 ≤ n. Also, all coefficients are ±1. Thus, the polynomials are also symbolically equal if working over the field K = Fp, for p ≥ n^2. By the Schwartz-Zippel lemma, plugging in random values from K for the variables will yield the same evaluation with probability ≤ (^1) n. This can be amplified to whp by trying O(1) times. Evaluating the polynomial at these random points can be done in O(n). All values fit in O(lg n) bits, and we can evaluate the polynomial in linear time by recursing on the tree, by the definition of the polynomial.
(a) The algorithm is as follows. Multiply all weights by 2m^2 + 10. Add to each edge a random integer drawn from { 1... 2 m}. Find the min-weight perfect matching as in the algorithm described in the class (min-weight with respect to the new weights). The result is also min-weight perfect matching (with respect to the initial weights) with probability at least 1/2. To see the correctness, let M be the value of the min-weight perfect matching (wrt to initial weights), and M ′^ the value of the min-weight perfect matching (wrt to new weights). Note that (2m^2 + 10)M ≤ M ′^ ≤ (2m^2 + 10)M + 2m^2 < (2m^2 + 10)(M + 1). This means that if a perfect matching is found (wrt to new weights), then it has minimum weight perfect matching wrt to initial weights too. Also, note that, with probability at least 1/2, there will exist exactly one perfect matching that minimizes sum of new weights modulo 2m^2 + 10 (due to the isolating lemma). This directly implies that with probability ≥ 1 /2, there will exists exactly one perfect matching that minimizes the sum of new weights. This means that with probability ≥ 1 /2, the algorithm succeeds in finding a perfect matching, which is the min-weight wrt to initial weights.
(b) If an edge has weight w then the corresponding Tutte matrix entry is given value 2w^ for the determinant calculation. Thus, if the input weights have a polynomial number of bits, then the number in the matrix will have an exponential number of bits so we will not be able to perform arithmetic operations on the efficiently.
(c) Given the graph G, build a complete bipartite graph G′^ where edge (i, j) has weight 1 if the (i, j) ∈ G and weight 2 if (i, j) ∈/ G. Any matching in G that has k edges corresponds to a matching in G′^ of total weight k + 2(n − k) = 2n − k. Thus a matching of minimum weight in G′^ corresponds to a maximum matching in G.
Let the distance matrix be D. We assume Aij = ∞ if no edge between i and j exists. The new APSP algorithm is a slight modification of the APSP algorithm from the book (page 288). Note that for any node i, and any neighbor k, we have that Dij − B ≤ Dkj ≤ Dij + B. Let ∆ = 2B + 3. Then, for any i, if Aik < ∞ and Dkj + Aik ≡ Dij ( mod ∆), then k is a valid candidate for Sij. We iterate over q from 0 to B, filling in entries of Sij. For a fixed value of q, we compute matrices D(s), for s = 0... ∆ − 1, where D( kjs) + q ≡ s( mod ∆).
Compute A′, where A′ ij = 1 iff Aij = q (and 0 otherwise). Finally, compute W (^) ij(s )= BPWM(A′, Ds). Then,
for all i, j, if there is a witness W (s) ij (i.e., if (A ′D(s))ij > 0), then Sij = W Dij^ mod^ ∆ ij. We have to verify two properties: 1) Sij is a valid successor and 2) all values Sij are filled in.