Question #63787

Are the following TRUE or FALSE. explain
n2 = O(n2)
n3 = O(n2)
n log n = O(n2)
n2 = O(n log2 n)
1

Expert's answer

2016-12-02T08:35:17-0500

Answer on Question #63787 – Math – Algorithms | Quantitative Methods

Question

Are the following TRUE or FALSE. Explain


n2=O(n2)n2 = O(n2)n3=O(n2)n3 = O(n2)nlogn=O(n2)n \log n = O(n2)n2=O(nlog2n)n2 = O(n \log 2 n)

Solution

a) n2=O(n2)n^2 = O(n^2)

**TRUE.** We can see this if we set c=1c = 1, then n2cn2=n2n^2 \leq c n^2 = n^2 for all n1n \geq 1.

Thus, the definition of big-0 holds for c=1c = 1 and n0=1n_0 = 1.

b) n3=O(n2)n^3 = O(n^2)

**FALSE.** For it to be true, we would need that there exist positive constants cc and n0n_0 such that n3cn2n^3 \leq c n^2 for all nn0n \geq n_0. By dividing both sides by n2n^2, we see that "n3cn2n^3 \leq c n^2 for all nn0n \geq n_0" is true if and only if "ncn \leq c for all nn0n \geq n_0" is true, but clearly there are no constants cc and n0n_0 for which the last statement is true.

c) nlogn=O(n2)n \log n = O(n^2)

**TRUE.** Because ln(1+x)x\ln(1 + x) \leq x for all x>1x > -1, hence ln(1+x)(x+1)1<2(x+1)\ln(1 + x) \leq (x + 1) - 1 < 2(x + 1).

Therefore, logn=O(n)\log n = O(n). There exist positive constants cc and n0n_0 such that logncn\log n \leq c n for all

nn0n \geq n_0. Multiplying both sides by nn gives nlogncn2n \log n \leq c n^2 for all nn0n \geq n_0 for the same positive constants cc and n0n_0, so nlogn=O(n2)n \log n = O(n^2).

d) n2=O(nlog2n)n^2 = O(n \log^2 n)

**FALSE.** First, note that n2=O(nlog2n)n^2 = O(n \log^2 n) if and only if there exist positive constants cc and n0n_0 such that n2cnlog2nn^2 \leq c n \log^2 n for all nn0n \geq n_0, which holds if and only if


n2nlog2n for all nn0\frac{n^2}{n \log^2 n} \text{ for all } n \geq n_0


By cancelling out the nn from the numerator and the denominator, we can rewrite expression in (1) as


nlog2nc for all nn0.\frac {n}{\log^ {2} n} \leq c \text{ for all } n \geq n _ {0}.


Writing n=n12n12n = n^{\frac{1}{2}}n^{\frac{1}{2}}, we see that the last statement is true if and only if


[n12logn]2c for all nn0.\left[ \frac {n ^ {\frac {1}{2}}}{\log n} \right] ^ {2} \leq c \text{ for all } n \geq n _ {0}.


Because we know that logn=o(n12)\log n = o\left(n^{\frac{1}{2}}\right) (in other words, limnlognn=0\lim_{n\to \infty}\frac{\log n}{\sqrt{n}} = 0), we have that


n12logn as n.\frac {n ^ {\frac {1}{2}}}{\log n} \rightarrow \infty \text{ as } n \rightarrow \infty.


So [n12logn]2c\left[\frac{n^{\frac{1}{2}}}{\log n}\right]^2 \leq c cannot be true for all nn0n \geq n_0 and for a constant cc.

Answer: TRUE, FALSE, TRUE, FALSE.

www.AssignmentExpert.com


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