Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Suppose that we implement the following wrapper algorithm: RepeatedRandomizedApproximateMiddle(A,p) // p is a probability value { K = ...... // K is calculated based on

Suppose that we implement the following wrapper algorithm:

RepeatedRandomizedApproximateMiddle(A,p) // p is a probability value { 
 K = ...... // K is calculated based on p // Below, RandomizedApproximateMiddle is called K times in total min = RandomizedApproximateMiddle(A); // It is called here for the first time 
 for (i = 1; i < K; i++) { 
 newOne = RandomizedApproximateMiddle(A); // It is called K-1 times here if (newOne < min) 

newOne = min;

}

return min; }

RepeatedRandomizedApproximateMiddle calls RandomizedApproximateMiddle exactly K times. It does this to make sure that the probability that RepeatedRandomizedApproximateMiddle returns an element with rank less than n/10 is at least p, where p is an input to the algorithm.

The value K is computed in the beginning of RepeatedRandomizedApproximateMiddle. The place the computation is performed for K is left as blank (......) above in the code. Please fill in the blanks above such that the probability that RepeatedRandomizedApproximateMiddle returns an element with rank less than n/10 is at least p.

YOU MUST SHOW ALL THE STEPS OF YOUR CALCULATION TO GET FULL GRADE. JUST WRITING THE RESULT WILL NOT GET YOU ANY POINT.

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

Practical Azure SQL Database For Modern Developers Building Applications In The Microsoft Cloud

Authors: Davide Mauri, Silvano Coriani, Anna Hoffma, Sanjay Mishra, Jovan Popovic

1st Edition

1484263693, 978-1484263693

More Books

Students also viewed these Databases questions