• edited by
8,667 views
7 7 votes

The increasing order of following functions in terms of asymptotic complexity is:

$\large \\ f_1(n)= n^{0.999999} \log n \qquad // \log n \text{ is not power of } n\\ f_2(n)=10000000*n \\ f_3(n)=10000000^n\\ f_4(n)=n^2$

(a) f1(n);      f4(n);      f2(n);      f3(n) 
(b) f1(n);      f2(n);      f3(n);      f4(n) 
(c) f2(n);      f1(n);      f4(n);      f3(n) 
(d) f1(n);      f2(n);      f4(n);      f3(n)

2 Answers

Best answer
7 7 votes

Incorrect Solution:

critical problem in this question is to find out which is greater between $f_1$ and $f_2$, for that purpose we take $\log$ on both functions:

for $f_1$:
$$\log \log n + 0.999999 \log n$$

for $f_2$:
$$\log n + \log 10^7$$

in $f_1$ we are adding a non-constant entity but that's not the case with $f_2$. Hence, $f_1$ is greater.

we get answer = option C like this.  BUT this is FALSE. Even after taking $\log$ we cannot deduce a meaningful conclusion coz Product terms cannot be ignored, See discussion in comments below.

So, a more robust approach is to see mathematically what happens when $n \rightarrow \infty$


Correct Solution:

let us assume that 0.999999 = 0.5, just to make things simple, it is a constant & also a fraction so it will continue to maintain its nature during this process, so this move is ok. Now, we have:
$\begin{align*} \lim_{n \rightarrow \infty} \left| \frac{f_1(n)}{f_2(n)} \right| &= \lim_{n \rightarrow \infty} \frac{\sqrt{n} \log n}{n}\\ &= \lim_{n \rightarrow \infty} \frac{\frac{1}{\sqrt{n}} + \frac{\log n}{2 \sqrt n}}{1}\\ &= \lim_{n \rightarrow \infty} \frac{2+ \log n}{2\sqrt{n}}\\ &= \lim_{n \rightarrow \infty} \frac{0+\frac{1}{n}}{2\times \frac{1}{2\sqrt{n}}}\\ &= \lim_{n \rightarrow \infty} \frac{1}{\sqrt{n}}\\ &= 0 \end{align*}$

since, at $n \rightarrow \infty$ shows that the value of the expression = $0$ this means that for sufficiently large $n$ the denominator has to be a much bigger value that is making the expression $=0$. So, $f_2$ is asymptotically bigger.

Hence, answer = option D

• selected by
Position:
Show:

Related questions

0 0 votes
1 1 answer
692
692 views
Chaitanya Kale asked Nov 10, 2022
692 views
Can we write f(2$^{n/a}$) = Θ(2$^{n}$) for any integer a >0?
0 0 votes
0 0 answers
414
414 views
Lakshman Bhaiya asked Nov 1, 2018
414 views
The iterated logarithmic function is defined as:$logn=0;$ $if$ $n\leq1$ $(or)$ $logn=1+log(logn);$ $if$ $n>1$Which of the following is/are $True?$$(1)logn=O(log(logn))...
1 1 vote
2 2 answers
2.7k
2.7k views
Lakshman Bhaiya asked Nov 1, 2018
2,704 views
Consider the following statements:$(1)$ Any two functions $f,g$ are always comparable under big Oh,that is $f=O(g)$ or $g=O(f)$$(2)$ If $f=O(g)$ and $f=O(h)$ then $g(n)=\...
1 1 vote
0 0 answers
1.1k
1.1k views
NIKU asked Nov 14, 2017
1,068 views
int unknown(int n) {inti, j, k = 0;for (i = n/2; i<= n; i++)for (j = 2; j <= n; j = j * 2)k = k + n/2;return k;}What is the returned value of the above function? (GATE CS...