Ask your own question, for FREE!
Mathematics 8 Online
OpenStudy (anonymous):

An urn containing n balls can be represented by the set U = {b1, b2, ... , bn}. Interpret the following algorithm in the context of urn problems. Does it represent drawing with or without replacement? How many lines does it print? for i is in {1, 2, ... , n} do for j is in {1, 2, ... , n} do for k is in {1, 2, ... , n} do print bi, bj, bk The algorithm prints out all the possible ways to draw balls in sequence,

OpenStudy (anonymous):

OpenStudy (reemii):

What would be the first (bi,bj,bk) to be printed?

OpenStudy (anonymous):

im not sure.. bi?

OpenStudy (reemii):

On the fourth line, you have "pritn bi,bj,bk". You print three numbers on the same line. What are they?

OpenStudy (reemii):

the outer loop: i starts with value 1, then we start the 2nd loop. -> j takes first value 1, and for j=1, we go to the third loop, where k=1,2,...,n. When k=1 for the first time, we have i=1 and j=1. Therefore the first line printed is (b1,b1,b1). This is a drawing from an experience WITH replacement.

OpenStudy (anonymous):

ok so for the second its bj,bj,bj and third b1,b1,b1?

OpenStudy (reemii):

no. these are nested loops. That means, when i=1, and j=1. you will go through all values of k. Review this topic carefully.

OpenStudy (anonymous):

@e.mccormick

OpenStudy (anonymous):

what is the answer?!?

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!