Reorder the following efficiencies from smallest to largest: 5n^5/2, 6log(n)+9n , 3n^4+nlog(n) , 5n^2+n^3/2
Answers
Answer:
There are total 9 questions. Please answer all questions correctly and paste answer or solutions pics here. Kindly don't send any book link..
Question 6. Reorder the following efficiencies from smallest to largest:
a. 2^n
b. n!
c. n^5
d. 10,000
e. nlog(n)
Question 8. Determine the big-O notation for the following:
a. 5n^5/2 + n^2/5
b. 6log(n) + 9n
c. 3n^4 + nlog(n)
d. 5n^2+ n^3/2
Question 10. Calculate the run-time efficiency of the following program segment:
for (i = 1; i <= n; i++)
for (j = 1; j <= n; j++)
for (k = 1; k <= n; k++)
print ("%d %d %d\n", i, j, k);
Question 11. If the algorithm doIt has an efficiency factor of 5n, calculate the run-time
efficiency of the following program segment:
for (i = 1, i <= n; i++)
doIt (...)
Question 12. If the efficiency of the algorithm doIt can be expressed as O(n) = n2, calculate
the efficiency of the following program segment:
for (i = 1; i <= n;; i++)
for (j = 1; j < n, j++)
doIt (...)
Question 14. Given that the efficiency of an algorithm is 5n2, if a step in this algorithm
takes 1 nanosecond (10^–9 seconds), how long does it take the algorithm to
process an input of size 1000?
Question 16. Given that the efficiency of an algorithm is 5nlog(n), if a step in this algorithm
takes 1 nanosecond (10– 9 seconds), how long does it take the algorithm
to process an input of size 1000?
Question 24. Write a pseudocode algorithm for giving all employees in a company a
cost-of-living wage increase of 3.2%. Assume that the payroll file includes
all current employees.
Question 30. Write the pseudocode for an algorithm that receives an integer and then
prints the number of digits in the integer and the sum of the digits. For
example, given 12,345 it would print that there are 5 digits with a sum of 15.