Question: Please, using C language, not C+or C++. Thanks. Homework 3 Files to submit: card_prob.c Time it took Matthew to Complete: 20 mins One thing I

Please, using C language, not C+or C++. Thanks.

Homework 3 Files to submit: card_prob.c Time it took Matthew to Complete: 20 mins

One thing I want to emphasize is that in this problem we are finding the actual probability not estimating through simulation. This means no need for random numbers.

All programs must compile without warnings when using the -Wall and -Werror options Submit only the files requested Do NOT submit folders or compressed files such as .zip, .rar, .tar, .targz, etc Your program must match the output exactly to receive credit. Make sure that all prompts and output match mine exactly. Easiest way to do this is to copy and paste them All input will be valid unless stated otherwise Print all real numbers to two decimal places unless otherwise stated The examples provided in the prompts do not represent all possible input you can receive. All inputs in the examples in the prompt are underlined You don't have to make anything underlined it is just there to help you differentiate between what you are supposed to print and what is being given to your program If you have questions please post them on Piazza Restrictions No global variables are allowed Your main function may only declare variables, call other functions, and assign

For this example we are assuming

The size of the deck is 10 cards

Are initial hand size is 3.

There are 3 copies of the card we are looking for

X's in the example represent the card we want. O's are other cards

We will mulligan 2 cards

We want to draw the desired card by turn 2

Lines with --------------------- in the probability are steps that don't involve drawing cards

Initial Draw

Hand Deck Probability Description
XXXOOOOOOO ----------- State at beginning
O XXXOOOOOO 7/10 Draw first card
OO XXXOOOOO 6/9 Draw second card
OOO XXXOOOO 5/8 Draw third card

Probability of not drawing the desired card in the initial draw: 7/10 * 6/9 * 5/8

Mulligan

Hand Deck Mulligan Space Probability Description
OOO XXXOOOO ------------ From Initial Draw
O XXXOOOO OO ------------ Set aside cards we are mulliganing
OO XXXOOO OO 4/7 Draw first replacement mulligan card
OOO XXXOO OO 3/6 Draw second replacement mulligan card
OOO XXXOOOO ------------ Shuffle mulliganed cards back into deck

Probability of not drawing desired card in the mulligan: 4/7 * 3/6

Drawing

Hand Deck Probablity Description
OOO XXXOOOO ----------- From Mulligan step
OOOO XXXOOO 4/7 Draw card on turn 1
OOOOO XXXOO 3/6 Draw Card on turn 2

Probability of not drawing the card during draw process is 4/7 * 3/6

The probability of not drawing at least 1 copy of the card we are looking for is Probability not drawing in initial hand * Probability not drawing in mulligan * Probability not drawing in during draw process. Filling in our numbers that is

(7/10 * 6/9 * 5/8) * (4/7 * 3/6) * (4/7 * 3/6)

And 1 minus the above is the probability of drawing at least 1 copy of the card by the desired turn

1 - (7/10 * 6/9 * 5/8) * (4/7 * 3/6) * (4/7 * 3/6)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!