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

Consider the following algorithm. for i is in {1, 2, 3, 4} do beep for j is in {1, 2, 3} do beep for k is in {1, 2, 3, 4} do for l is in {1, 2, 3, 4, 5} do beep for m is in {1, 2, 3, 4, 5, 6} do beep How many times does a beep statement get executed?

OpenStudy (phi):

start with the inner most loops: for L beeps 5 times, and for m beeps 6 times that is 11 total within the k loop k executes 4 times, so 4*11 beeps = 44 at the same level for j loops 3 times = 3 beeps 47 total beeps plus 1 standalone beep gives 48 beeps per step in the for i loop i has 4 steps, so 4*48 = 192 beeps

OpenStudy (amistre64):

i get 188

OpenStudy (amistre64):

i is in {1, 2, 3, 4} do {beep for j is in {1, 2, 3} do beep for k is in {1, 2, 3, 4} do {for l is in {1, 2, 3, 4, 5} do beep for m is in {1, 2, 3, 4, 5, 6} do beep } } 4(3+4(5+6)) 4(3+4(11)) 4(3+44) 4(47) 188

OpenStudy (amistre64):

i see, i droped the 1

OpenStudy (amistre64):

in my defense, they should have said: for this {1} :)

OpenStudy (anonymous):

thanks guys :)

OpenStudy (anonymous):

=152

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!