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

Can someone help me with this? I\'m not sure what this is asking, nor do I know

ID: 3792984 • Letter: C

Question

Can someone help me with this? I'm not sure what this is asking, nor do I know how to do it. I put comments on what i think each is but im not exactly sure..

Algorithm of:

for ( j = 0; j < n; j++ ) // n   

{

for ( k = j; k < n; k++ ) // n

{

}

} // O(n^2) ?
will result in a number of iterations of given by the expression:

= n + (n-1) + (n-2) + (n-3) + ........ + (n - n)

There is no code to write, the answer is text expressing the following:

Reduce the above series expression to an algebraic expression, without summation.

After determining the algebraic expression express the performance in Big O Notation.

Explanation / Answer

So the summation is n+(n-1)+(n-2)+(n-3)+.....+1+0

This is equivalent to 1+2+3+4+5+6+7+8+......+n

Now this is an A.P. with number of terms=n

SUM=n/2(1+n)= n/2+n2/2 (Algebraic expression)

THEREFORE IT IS O(n2)

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