CMSC350_Homework1

EX 2.1 What is the order of the following growth functions?
a. 10n^2 + 100n + 1000
b. 10n^3 - 7
c. 2^n + 1000n^3
d. n^2 log n
Ex 2.2 Arrange the growth functions of the previous exercise in ascending order of
efficiency for n=10 and again for n=1,000,000. 
 EX 2.3 Write the code necessary to find the largest element in an unsorted array of
integers. What is the time complexity of this algorithm?



 Determine the growth function and order of the following code fragment:
for (int count=0; count < n; count++)
{
for (int count2=0; count2 < n; count2=count2+2) {
System.out.println(count, count2);
}
}

EX 2.5 Determine the growth function and order of the following code fragment:
for (int count=0; count < n; count++)
{
for (int count2=0; count2 < n; count2=count2*2) {
System.out.println(count, count2);
}
}
Powered by