4. Stochastic algorithms: A programmer can choose between two algorithms (A and B) to solve a problem that we call "Q". Algorithm A is deterministic, i.e. it is guaranteed to find an answer, and always takes the same time (20 hours) to solve Q. Algorithm B is stochastic, i.e. it makes use of random numbers internally, but we will not "look inside" the algorithm. Algorithm B does not always find an answer, but it runs quickly. It always has a running time of 0.5 hours (on problem Q), regardless of whether it succeeds in finding an answer or not, and it gives a message when it fails. Therefore, B must be run several times until it finds the answer. We define p = P (B finds the answer) for a single run, and that different runs of B are independent (with regard to whether they find the answer or not). (a) If p = 0.04, what is the expected total running time before algorithm B finds an answer? Should the programmer choose algorithm A or B for problem Q? (Hint: look at geometric distribution)
4. Stochastic algorithms: A programmer can choose between two algorithms (A and B) to solve a problem that we call "Q". Algorithm A is deterministic, i.e. it is guaranteed to find an answer, and always takes the same time (20 hours) to solve Q. Algorithm B is stochastic, i.e. it makes use of random numbers internally, but we will not "look inside" the algorithm. Algorithm B does not always find an answer, but it runs quickly. It always has a running time of 0.5 hours (on problem Q), regardless of whether it succeeds in finding an answer or not, and it gives a message when it fails. Therefore, B must be run several times until it finds the answer. We define p = P (B finds the answer) for a single run, and that different runs of B are independent (with regard to whether they find the answer or not). (a) If p = 0.04, what is the expected total running time before algorithm B finds an answer? Should the programmer choose algorithm A or B for problem Q? (Hint: look at geometric distribution)
Linear Algebra: A Modern Introduction
4th Edition
ISBN:9781285463247
Author:David Poole
Publisher:David Poole
Chapter2: Systems Of Linear Equations
Section2.4: Applications
Problem 28EQ
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps
Recommended textbooks for you
Linear Algebra: A Modern Introduction
Algebra
ISBN:
9781285463247
Author:
David Poole
Publisher:
Cengage Learning
Linear Algebra: A Modern Introduction
Algebra
ISBN:
9781285463247
Author:
David Poole
Publisher:
Cengage Learning