Question: Problem 2. Suppose we have an array A[1 : n) which consists of numbers {1,..., n} written in some arbitrary order (this means that A

 Problem 2. Suppose we have an array A[1 : n) which

Problem 2. Suppose we have an array A[1 : n) which consists of numbers {1,..., n} written in some arbitrary order (this means that A is a permutation of the set {1,..., n}). Our goal in this problem is to design a very fast randomized algorithm that can find an index i in this array such that A[i] mod 3 : 0, i.e., A[i] is divisible by 3. For simplicity, in the following, we assume that n itself is a multiple of 3 and is at least 3 (so a correct answer always exist). So for instance, if n = : 6 and the array is A = (2, 5, 4, 6, 3, 1], we want to output either of indices 4 or 5. (a) Suppose we sample an index i from {1,...,n} uniformly at random. What is the probability that i is a correct answer, i.e., A[i] mod 3 = 0? (b) Suppose we sample m indices from {1,...,n} uniformly at random and with repetition. What is the probability that none of these indices is a correct

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!