Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

please let me know just the answer Let with n ? 3. Interpret the following algor

ID: 3705377 • Letter: P

Question

please let me know just the answer

Let

with

n ? 3.

Interpret the following algorithm in the context of urn problems.

bi, bj, bk

How many lines does it print?

It prints all the possible ways to draw three balls in sequence, with replacement. It prints P(n, 3) lines.It prints all the possible ways to draw three balls in sequence, with replacement. It prints C(n, 3) lines.    It prints all the possible ways to draw an unordered set of three balls, without replacement. It prints P(n, 3) lines.It prints all the possible ways to draw three balls in sequence, without replacement. It prints P(n, 3) lines.It prints all the possible ways to draw three balls in sequence, without replacement. It prints C(n, 3) lines.

for

i {1, 2, , n}

do      for

j {1, 2, , n} {i}

do      for

k {1, 2, , n} {i, j}

do     print

bi, bj, bk

7. -6. 25 points HunterUM3 4 5 .015. My N Let u- bb. . bn) with n2 3. Interpret the following algerithm in the context of urn problems tor E1, 2, de r for ie{1, 2, ,n} {i} do L L Print ib, bk How many lines does it print? Il prints all the possible ways lo draw three balls in sequerice, with replaeent. Il prints Pn, 3) lines It prints all the possible ways to draw three halls in sequence, with replacement. It prints a, 3) lines. It prints all the possible ways to draw an unordered set of three balls, without replacement. It prints Pin, 3) lincs. O It prints all the passible ways to draw three balls in sequence, without replacement. It prints p(, 3) llnes. OIt prints all the possible ways to draw three halls in sequence, without replacement. It prints cn, 3) lines

Explanation / Answer

When i=1 we will take j from 2 to n and k from 3 to n this is because the algorithm says that j belongs to {1,2,...,n} /{i} , which means that j will be from  {1,2,...,n} except the i value at that time and k will be from  {1,2,...,n} except the {i,j} value at that time.

Therefore for each value of i , j will run (n-1) times

and for each value of {i,j} , k will run (n-2) times

Thus totally it will run = n(n-1)(n-2) times.

So bi,bj,bk will be printed  n(n-1)(n-2) and all the values i.e bi,bj,bk will be distinct.

This is nothing but P(n,3) = n(n-1)(n-3)

Therefore,  It prints all the possible ways to draw an unordered set of three balls, without replacement. It prints P(n, 3) lines.