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

Describe the order of growth of each of the following code sections, using 0 not

ID: 2247323 • Letter: D

Question

Describe the order of growth of each of the following code sections, using 0 notation:

a. count = 0;

for (i = 1; i <= N; i++)

count++;

b. count = 0;

for (i = 1; i <= N; i++)

for (j = 1; j <= N; j++)

count++;

c. value = N;

count = 0;

while (value > 1)

{

value = value / 2;

count++;

}

d. count = 0;

value = N;

value = N * (N -1);

count = count + value;

e. count = 0;

for (i = 1; i <= N; i++)

count++;

for (i = N; i >= 0; i--)

count ++;

f. count = 0;

for (i = 1; i <= N; i++)

for (j = 1; j <= 5; j++)

count++;

Explanation / Answer

Hi...

a. count = 0;
for (i = 1; i <= N; i++)
count++;
b. count = 0;
for (i = 1; i <= N; i++)
for (j = 1; j <= N; j++)
count++;
c. value = N;
count = 0;
while (value > 1)
{
value = value / 2;
count++;
}
d. count = 1;
value = N;
value = N * (N -1);
count = count + value;
e. count = 1;
for (i = 1; i <= N; i++)
count++;
for (i = N; i >= 0; i--)
count ++;
f. count = 1;
for (i = 1; i <= N; i++)
for (j = 1; j <= 5; j++)
count++;

Thanks

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote