59 59 votes Consider the following functions: $f(n) = 2^n$ $g(n) = n!$ $h(n) = n^{\log n}$ Which of the following statements about the asymptotic behavior of $f(n)$, $g(n)$ and $h(n)$ is true? $f\left(n\right)=O\left(g\left(n\right)\right); g\left(n\right)=O\left(h\left(n\right)\right)$ $f\left(n\right) = \Omega\left(g\left(n\right)\right); g(n) = O\left(h\left(n\right)\right)$ $g\left(n\right) = O\left(f\left(n\right)\right); h\left(n\right)=O\left(f\left(n\right)\right)$ $h\left(n\right)=O\left(f\left(n\right)\right); g\left(n\right) = \Omega\left(f\left(n\right)\right)$ Algorithms gatecse-2008 algorithms asymptotic-notations normal + – Kathleen 28.5k views answer comment Share Follow Print See all 7 Comments 7 7 Comments reply Show 4 previous comments nainasachdev01 commented May 6, 2021 reply Follow flag n! Factorial is always greater than exponential. And 2^n always > n^logn (Remember the sequence of what has higher growth rate than compared to others) Hence h(n)<f(n)<g(n) So h(n)= Of(n) and f(n)=Og(n) We can also write f(n)=Og(n) as g(n)=omega(f(n)) Hence option D is correct. 4 4 replyShare pavansan commented Jan 1, 2025 reply Follow flag got it 0 0 replyShare js__ commented Oct 18, 2025 reply Follow flag h(n) = O(f(n)); g(n) = Ω(f(n))h(n) = O(f(n)): Does h grow no faster than f? Yes, because f > h. This part is TRUE.g(n) = Ω(f(n)): Does g grow at least as fast as f? Yes, because g > f. This part is TRUE. 1 1 replyShare Please log in or register to add a comment.
Best answer 58 58 votes $g(n) = n!$. On expanding the factorial we get $g(n) = O(n^n)$ :$$\begin{align*} n^n &> n^{\log n} \\ n^n &> 2^n \end{align*}$$This condition is violated by options $A$, $B$ and $C$ by first statements of each. Hence, they cannot be said to be TRUE. Second statement of option $D$ says that $g(n)$ is asymptotically biggest of all. Answer is option (D). amarVashishth answered Nov 6, 2015 • edited Jun 24, 2018 by Shikha Mallick 2 flags: ✌ Low quality (Anurag Prasad “Incorrect explanation. Given explanation can not be used to conclude that the first 3 options are incorrect.”)✌ Low quality (Alok_Mandal) amarVashishth comment Share Follow See all 5 Comments 5 5 Comments reply Show 2 previous comments Shubhgupta commented Dec 6, 2018 reply Follow flag I think in option A because of 2nd statement it is wrong. am i right? 0 0 replyShare jatin khachane 1 commented Dec 24, 2018 reply Follow flag @Shubhgupta yes 0 0 replyShare Kiyoshi commented May 27, 2021 reply Follow flag @ amarVashishth This condition is violated by options A, B and C by first statements of each. In option B and C this is correct. but for option A it is wrong. f(n) = O(g(n)) implies $2^{n}=O(n!)$ first statement is correct. g(n)=O(h(n)) implies $n!=O(n^{logn})$ second statement is false. 1 1 replyShare Please log in or register to add a comment.
37 37 votes $f(n)$ $g(n)$ $h(n)$ $n = 2^{10}$ $2^{1024}$ $1024!$ ${2^{10}}^{10} = 2^{100}$ $n = 2^{11}$ $2^{2048}$ $2048!$ $2^{121}$ Increase $2^{1024}$ $1025 \times 1026 \times \dots \times 2048$ $2^{21}$ So, growth rate is highest for $g(n)$ and lowest for $h(n)$. Option D. Arjun answered Sep 17, 2015 Arjun comment Share Follow See 1 comment 1 1 comment reply AneeshS commented Sep 30 reply Follow flag @Arjun Sir, I see that you have used this method to solve most of the complexity analysis Questions, but could you please tell me if I take log throughout and solve wont that work for all questions of this type? 0 0 replyShare Please log in or register to add a comment.
33 33 votes Take log of all function with base 2 log(f(n)) = Log(2^n) = n log(g(n)) = Log(n!) = Log(n^n) // using sterling approximation = nlogn Log(h(n)) = Log(n ^ logn) = log(n) * log(n). It becomes clear now that h(n) < f(n) < g(n). Looking at options D is only option which satisfy this constraints. Akash Kanase answered Nov 22, 2015 Akash Kanase comment Share Follow See all 3 Comments 3 3 Comments reply abhi_sasuke commented Jul 2, 2020 reply Follow flag In D, h(n) = O(f(n)), is this right?/ 0 0 replyShare Franz Kafka commented Oct 23, 2024 reply Follow flag Yes. $h(n)=O(f(n))$ simply translates to, $h(n) \leq f(n)$, which is true here. 0 0 replyShare Vaibdoesit commented Jun 14, 2025 reply Follow flag logarithms are borderline magical man. 0 0 replyShare Please log in or register to add a comment.
11 11 votes Answer is D. 1 < loglogn < logn < ne < nc < nlogn < cn < nn < cc^n < n! . Gate Keeda answered Dec 11, 2014 Gate Keeda comment Share Follow See all 3 Comments 3 3 Comments reply satyaki sen 1 commented Sep 10, 2015 reply Follow flag 1 < loglogn < logn < ne < nc < nlogn < cn < nn < cc^n < n! isn't n! = O(n^n)? 4 4 replyShare Vishal.kishan commented Aug 24, 2024 i edited by Vishal.kishan Aug 24, 2024 reply Follow flag Very helpful 0 0 replyShare Vaibdoesit commented Jun 14, 2025 reply Follow flag incorrect. grows faster than n!. Ty by taking log. Please correct it. 0 0 replyShare Please log in or register to add a comment.
2 2 votes Take log on both sides of the functions and compare each functions. eg 2n n! taking log on both sides nlog(base 2) log(n!) and put n = 2^128 or some 2^k values ll get nlog(base2) < log(n!) and simlarly for 2^n and n^logn now, 2^n > n^logn so n! > 2^n > n^logn Answer is (D). correct me if i'm wrong 2n Prasanna answered Sep 17, 2015 Prasanna comment Share Follow 0 reply Please log in or register to add a comment.
0 0 votes g(n) > f(n) > h(n) By looking at the options we can directly eliminate Options : A,B,C Option D is correct answer Arnav Singh_01 answered Sep 7, 2024 Arnav Singh_01 comment Share Follow 0 reply Please log in or register to add a comment.