Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Just answer parts a and b. 1. [10] Consider the following algorithm that describes the procedure of a casino game called Game148. The index of
Just answer parts a and b.
1. [10] Consider the following algorithm that describes the procedure of a casino game called "Game148". The index of the array A starts at 1. Let n denote the length of A 1def Game 148 (A) Pre: A is a list of integers, len (A) > 148, and it is generated according to the distribution specified below winnings _6.00 # the player pays 6 dollars for each play for ifrom n downto 1: winnings winnings + 0.01 # winning 1 cent if A[i] 148: 10 print ("Boom! Game Over.") return winnings 12 13 print(" You survived! ") return winnings The input array A is generated in the following specific way: for A1] we pick an integer from 0,1 uniformly at random; for A[2] we pick an integer from {0,1,2} uniformly at random; for A|3] we pick an integer from 10, 1,2, 3) uniformly at random, etc. That is, for Ali we pick an integer from s0,...,i} uniformly at random. All choices are independent from each other. Now, let's analyse the player's expected winnings from the game by answering the following questions. All your answers should be in exact form, i.e., not in asymptotic notations. (a) Consider the case where the player loses the most (i.e, minimum winnings), what is the return value of Game148 in this case? What is the probability that this case occurs? Justify your answer carefully: show your work and exp lain your calculation. (b) Consider the case where the player wins the most (i.e., maximum winnings), what is the return value of Game148 in this case? What is the probability that this case occurs? Justify your answer carefully: show your work and explain your calculation. (c) Now consider the average case, what is the expected value of the winnings of a player (i.e., the expected return value of Game148) according to the input distribution specified above? Justify your answer carefully: show your work and explain your calculation. (d) Suppose that you are the owner of the casino and that you want to determine a length of the input list A so that the expected winnings of a player is between 1.01 and -0.99 dollars (so that the casino is expected to make about 1 dollar from each play). What value could be picked for the length of A? You are allowed to use math tools such as a calculator or WolframAlpha to get yourStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started