Exercise I. For each of the following three program fragments:

a. Count the number of multiplication as basic operation, and state the Big-Oh for each complexity. Prove only how did you get the big-Oh only for part 1.

b. Implement the code in the language of your choice, and find the running time for several values of n.

c. Compare the theoretical time complexity with the actual running times.

1.
NegativeSumSquare = 0;
for(i = 1; i <= n; i++)
Sum = Sum - i * i;

2.
Negative3SumSquare = 0;
for(i = 1; i <= 3*n; i++)
Negative3Sum = Negative3Sum - i*i;

3.
NegativeSubSumSquare = 0;
for(i = 1; i <= n; i++)
for(j = 1; j <=i; j++)
NegativeSubSum = NegativeSubSum - j*j;
Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.