Suppose two teams, A and B, are playing a match to see who is the first to win n games | StudySoup

Textbook Solutions for Algorithms

Chapter 6 Problem 6.15

Question

Suppose two teams, \(A\) and \(B\), are playing a match to see who is the first to win \(n\) games (for some particular \(n\)). We can suppose that \(A\) and \(B\) are equally competent, so each has a 50% chance of winning any particular game. Suppose they have already played \(i+j\) games, of which \(A\) has won \(i\) and \(B\) has won \(j\). Give an efficient algorithm to compute the probability that \(A\) will go on to win the match. For example, if \(i=n-1\) and \(j=n-3\) then the probability that \(A\) will win the match is 7/8, since it must win any of the next three games.

Solution

Step 1 of 2

The given problem can be solved by using dynamic programming. Let \(R(i, j)\) denote the required probability. Then,

\(R(i, j)=1\) for \(i=0, j>0\) means \(A\) has already won the match.

\(R(i, j)=1\) for \(i=0, j>0\) means \(B\) has already won the match.

\(R(i, j)=\frac{R(i-1, j)+R(i, j-1)}{2} \text { for } i>0, j>0\) means more games should be played and each team wins half the time.

Subscribe to view the
full solution

Title Algorithms  1 
Author Sanjoy Dasgupta Algorithms, Christos H. Papadimitriou Algorithms, Umesh Vazirani Algorithms
ISBN 9780073523408

Suppose two teams, A and B, are playing a match to see who is the first to win n games

Chapter 6 textbook questions

×

Login

Organize all study tools for free

Or continue with
×

Register

Sign up for access to all content on our site!

Or continue with

Or login if you already have an account

×

Reset password

If you have an active account we’ll send you an e-mail for password recovery

Or login if you have your password back