Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3. We are given a length-n binary list L. In other words, LDle {0, 1} for all j = 1.2, , n. Our problem is

image text in transcribed

3. We are given a length-n binary list L. In other words, LDle {0, 1} for all j = 1.2, , n. Our problem is to count the number of 0's in L. We could of course solve this problem in (n) time by simply scanning L, but we want to solve it faster and so we turn to randomization. The randomized algorithm we use is the following function CouNTZEROES(L) n length(L) count 0 for j l to 100 do Comment: pick a random index i between 1 and n i random(1, n) if L[i] = 0 then count count 1 return r count/100 (a) What is the running time of this algorithm? Please show all your work. (b) Suppose that n = 106 and exactly a quarter of the elements in L are 0, what is the probability that the CouNtZEROES function returns 0? (c) A random variable X has binomial distribution with parameters m (a positive integer) and p (a real number between 0 and 1) if Pr(X = k] =CE).pk " (1-p)'n-k The way to think about X being binomially distributed is that we perform m indepen dent random trials and each trial can either succeed or fail. The "success" probability of a trial is p and so the failure probability of a trial is 1 - p. Then the random variable X represents the number of successful trials, out of m total random trials. To understand the formula in (1) note that the probability of k successful trials is p*, the probability of (m-k) unsuccessful trials is (1-p)m-k, and there are (79 ways of distributing the k successful trials among the m random trials. As in (b) suppose that n = 106 and exactly a quarter of the elements in L are 0. Using the above expression for a binomial distribution, write down the expression for the probability that CoUNTZEROES returns the correct answer, namely 106/4

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Database Programming

Authors: Chris Fehily

1st Edition

1937842312, 978-1937842314

More Books

Students also viewed these Databases questions

Question

What is a strong assumption? What is a weak assumption?

Answered: 1 week ago

Question

Compute E[B(t1)B(t2)B(t3)] for t1 Answered: 1 week ago

Answered: 1 week ago