Introduction to Algorithms
3rd Edition
ISBN: 9780262033848
Author: Thomas H. Cormen, Ronald L. Rivest, Charles E. Leiserson, Clifford Stein
Publisher: MIT Press
expand_more
expand_more
format_list_bulleted
Question
Chapter 35.4, Problem 1E
Program Plan Intro
Toprove that both variable and its negation yields a randomized 8/7 − approximation
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
If five integers are chosen from the set {1, 2, 3, 4, 5, 6, 7, 8}, must there be at least two integers with the property that the larger minus the smaller is 2? Write an answer that would convince a good but skeptical fellow student who has learned the statement of the pigeonhole principle but not seen an application like this one. Describe the pigeons, the pigeonholes, and how the pigeons get to the pigeonholes.
Write an expression for the decomposition of selection bias in each of the following cases.
Which is the "worst"?
(a)
(b)
(c)
Sx = 0
X = [0, 1], Six = [0, 0.75], Sox= [0.25, 1], f(x) = 1
X = 2¹
Let pn(x) be the probability of selling the house to the highest bidder when there are n people, and you adopt the Look-Then-Leap algorithm by rejecting the first x people. For all positive integers x and n with x < n, the probability is equal to p(n(x))= x/n (1/x + 1/(x+1) + 1/(x+2) + … + 1/(n-1))
If n = 100, use the formula above to determine the integer x that maximizes the probability n = 100 that p100(x). For this optimal value of x, calculate the probability p100(x).
Briefly discuss the significance of this result, explaining why the Optimal Stopping algorithm produces a result whose probability is far more than 1/n = 1/100 = 1%.
Chapter 35 Solutions
Introduction to Algorithms
Ch. 35.1 - Prob. 1ECh. 35.1 - Prob. 2ECh. 35.1 - Prob. 3ECh. 35.1 - Prob. 4ECh. 35.1 - Prob. 5ECh. 35.2 - Prob. 1ECh. 35.2 - Prob. 2ECh. 35.2 - Prob. 3ECh. 35.2 - Prob. 4ECh. 35.2 - Prob. 5E
Ch. 35.3 - Prob. 1ECh. 35.3 - Prob. 2ECh. 35.3 - Prob. 3ECh. 35.3 - Prob. 4ECh. 35.3 - Prob. 5ECh. 35.4 - Prob. 1ECh. 35.4 - Prob. 2ECh. 35.4 - Prob. 3ECh. 35.4 - Prob. 4ECh. 35.5 - Prob. 1ECh. 35.5 - Prob. 2ECh. 35.5 - Prob. 3ECh. 35.5 - Prob. 4ECh. 35.5 - Prob. 5ECh. 35 - Prob. 1PCh. 35 - Prob. 2PCh. 35 - Prob. 3PCh. 35 - Prob. 4PCh. 35 - Prob. 5PCh. 35 - Prob. 6PCh. 35 - Prob. 7P
Knowledge Booster
Similar questions
- no handwritten Alice and Bob are playing a match to see who is the first to win n games, for some fixed n > 0. Suppose Alice and Bob are equally competent, that is, each of them wins a game with probability 1/2. Further, suppose that they have already played i + j games, of which Alice won i and Bob won j. Give an efficient algorithm to compute the probability that Alice will go on to win the match. For example, if i = n − 1 and j = n − 3, then the probability that Alice will win the match is 7/8, since she must win any of the next three games.arrow_forwardConsider two algorithms for the same problem: • Algorithm A, which runs in O(n) and produces a correct answer with probability 0.7, and a wrong answer with probability 0.3. • Algorithm B, which runs in O(n log n) and produces a correct answer with probability 0.99, and a wrong answer with probability 0.01. Which of the two algorithms should you use to build a more asymptotically (in n) efficient algorithm with probability 0.99 of producing a correct answer? Justify. Assume that you can always check if an answer is correct in constant time.arrow_forwardWrite Algorithm for Generating a random number from a distribution described by a finite sequence of weights.in: sequence of n weights W describing the distribution (Wi ∈ N for i = 0, . . . , (n − 1) ∧ 1 ≤ n−1 i=0 Wi)out: randomly selected index r according to W (0 ≤ r ≤ m − 1)arrow_forward
- • Simplify the Boolean functions by means of the tabulation matching method: a. F(w,x,y,z) = Σm(2,3,12,13,14,15) b. P(m,n,o,p,q,r) =Em(6,9,13,18,19,25,27,29,41,45,57,61) c. P(A,B,C,D,E,F,G) =Σm(20,28,38,39,52,60,102,103)arrow_forwardWe have considered, in the context of a randomized algorithm for 2SAT, a random walk with a completely reflecting boundary at 0—that is, whenever position 0 is reached, with probability 1 we move to position 1 at the next turn. Consider now a random walk with a partially reflecting boundary at 0– whenever position 0 is reached, with probability 1/4 we move to position 1 at the next turn, and with probability 3/4 we stay at 0. Everywhere else the random walk either moves up or down 1, each with probability 1/2. Find the expected number of moves to reach n starting from position i using a random walk with a partially reflecting boundary. (You may assume there is a unique solution to this problem, as a function of n and i; you should prove that your solution satisfies the appropriate recurrence.)arrow_forwardRecall the Monte Carlo method, from week 6 (section 6.2.2), for approximating . Suppose we choose a point (x, y) randomly (with uniform distribution) in the unit square. The probability that it lies inside a circle of diameter 1 contained in the unit square is equal to the area of that circle, or π/4. So this Monte Carlo method works as follows: Write a function montecarlo (M) which takes an integer M and returns an approximation to π. (I can't give you an example output, as the random nature of the procedure means approximations will differ!)arrow_forward
- Considering the function f(x) = x – cos(x), what is the value of x7 after performing fixed point iteration. Assume an initial guess of 1. Use the equation form that will seem fit according to the choices provided.Group of answer choices 0.72210 0.71537 0.76396 0.72236arrow_forwardPick one million sets of 12 uniform random numbers between 0 and 1. Sum up the 12 numbers in each set. Make a histogram with these one million sums, picking some reasonable binning. You will find that the mean is (obviously?) 12 times 0.5 = 6. Perhaps more surprising, you will find that the distribution of these sums looks very much Gaussian (a "Bell Curve"). This is an example of the "Central Limit Theorem", which says that the distribution of the sum of many random variables approaches the Gaussian distribution even when the individual variables are not gaussianly distributed. mean Superimpose on the histogram an appropriately normalized Gaussian distribution of 6 and standard deviation o = 1. (Look at the solutions from the week 5 discussion session for some help, if you need it). You will find that this Gaussian works pretty well. Not for credit but for thinking: why o = 1 in this case? (An explanation will come once the solutions are posted).arrow_forwardWe have already had a recurrence relation of an algorithm, which is T (n) = 4T (n/2) + n log n. We know T (1) ≤c.(a) express it as T (n) = O(f (n)), by using the iteration method.(b) Prove, by using mathematical induction, that the iteration rule you have observed in (a) is correct and you have solved the recurrence relation correctly. [Hint: You can write out the general form of T (n) at the iteration step t, and prove that this form is correct for any iteration step t by using mathematical induction. Then by finding out the eventual number of t and substituting it into your general form of T (n), you get the O(·) notation of T (n).]arrow_forward
- Correct answer will be upvoted else downvoted. Computer science. You are given a double string s of length n. Develop two adjusted section successions an and b of length n to such an extent that for all 1≤i≤n: on the off chance that si=1, ai=bi on the off chance that si=0, ai≠bi In case it is inconceivable, you should report about it. Input The principal line contains a solitary integer t (1≤t≤104) — the number of experiments. The primary line of each experiment contains a solitary integer n (2≤n≤2⋅105, n is even). The following line contains a string s of length n, comprising of characters 0 and 1. The amount of n across all experiments doesn't surpass 2⋅105. Output If such two adjusted bracked arrangements exist, output "YES" on the primary line, in any case output "NO". You can print each letter regardless (upper or lower). If the appropriate response is "YES", output the fair section groupings an and b fulfilling the conditions on the following…arrow_forwardWhich of the following best describes the useful criterion for comparing the efficiency of algorithms? None of the above Memory Time Both Time and Memoryarrow_forwardProcedure 1 (Local Search(y) with depth δ) t := 1.While t ≤ δ and ∃z : (H(z,y)=1 and f(z) > f(y)) do y := z. t := t + 1.If there is more than one Hamming neighbor with larger fitness, z may be chosen arbitrarily among them.Algorithm 1 ((1+1) Memetic Algorithm ((1+1) MA)) write correct algorithm otherwise you will get downvote.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education