Question #159659

1. A. (20p) Give a Big-O estimate that is as good as possible for each of the following functions.

i. (n^3 + n)(logn + n)

ii. (n + 1000)(logn + 1)

B. (15p) If these are complexities of algorithms that solve the same problem, which one would you

prefer? Why?

C. (15p) Considering the Big-O complexity, how many times is your choice faster with respect to the

other solution for an input size of 2^16?

Note: The base of logarithm is 2


1
Expert's answer
2021-02-01T10:33:49-0500

A.i. (n3+n)(log2n+n)=n4(1+n2)(1+log2n/n)=O(n4)(n^3 + n)(\log_2 n + n)=n^4(1+n^{-2})(1+\log_2 n / n)=O(n^4)

ii. (n+1000)(log2n+1)=nlog2n(1+1000n)(1+1log2n)=O(nlog2n)(n + 1000)(\log_2n + 1) = n\log_2n(1 + \frac{1000}{n})(1+\frac{1}{\log_2n}) = O( n\log_2n) B. The second estimate of the complexity is preferable, as its growth is much more slower.

C. If n=216 then

n4=264n^4 = 2^{64} ,

nlog2n=21624=220n\log_2n = 2^{16}\cdot 2^4 = 2^{20}

and the second estimate of the complexity is 244 times better.


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!
LATEST TUTORIALS
APPROVED BY CLIENTS