GATE / CS ARCHIVE

SIMILAR QUESTIONS / ALGORITHMS

Order standard functions by logarithmic growth comparison

6 questions solved the same way, newest first. Back to Algorithms

How these are solved

Simplify exponent/log identities and compare logarithms or ratios to place polynomial, polylogarithmic, quasipolynomial, exponential and factorial expressions. Each explicitly compares asymptotic growth of concrete functions.

1 mark · MCQ
Report issue

Ordering four asymptotic functions

Asymptotic Analysis & Recurrences

Question 24, GATE 2026: With logarithms base 2, order n^(1/3), log n, log(n!), and 2^(log n) by increasing asymptotic growth. A log n,n^(1/3),2^(log n),log(n!); B n^(1/3),log n,log(n!),2^(log n); C log n,n^(1/3),log(n!),2^(log n); D 2^(log n),n^(1/3),log n,log(n!).
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Givens and goal

With logarithms base 2, order n1/3, log n, log(n!), and 2log n by increasing asymptotic growth. A log n,n1/3,2log n,log(n!); B n1/3,log n,log(n!),2log n; C log n,n1/3,log(n!),2log n; D 2log n,n1/3,log n,log(n!).

Approach

Simplify the exponential and bound the factorial logarithm.

Step-by-step solution

1. Because the bases match, 2log₂n=n exactly. It must therefore be compared as a linear function, not as an arbitrary exponential.
2. Write log(n!)=Σ(k=1 to n)log k. Every summand is at most log n, giving an upper bound n log n. The last at least n/2 summands are at least log(n/2), giving a lower bound (n/2)log(n/2). Thus log(n!)=Θ(n log n).
3. Any fixed positive power of n eventually dominates log n, so log n=o(n1/3). Also n1/3/n=n−2/3→0, and n/(n log n)=1/log n→0.
4. The required increasing order is log n, n1/3, n, Θ(n log n), matching A. This is an eventual growth comparison, not a claim of strict ordering at every small input.

Original paper, page 19 · Answer key

1 mark · MCQ
Report issue

Asymptotic Analysis & Recurrences

Question 3, GATE 2021: Let f1=10^n, f2=n^(log n), and f3=n^(√n). Arrange by increasing asymptotic growth. A f3,f2,f1; B f2,f1,f3; C f1,f2,f3; D f2,f3,f1.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Taking logarithms gives log f2=Θ((log n)²), log f3=√n log n, and log f1=n log10. Since (log n)²=o(√n log n) and √n log n=o(n), the increasing order is f2, f3, f1, D.

Logarithms are strictly increasing on positive values, so their comparison preserves the order. Ratios of logarithms settle both gaps: (log n)²/(√n log n)=(log n)/√n→0 and (√n log n)/n=(log n)/√n→0. Consequently f2/f3 and f3/f1 tend to zero. The phrase 'n raised to log n' is not n log n; misreading the exponent would change the classification.

Original paper, page 13 · Answer key

2 marks · MCQ
Report issue

Ordering polynomial quasipolynomial exponential growth

Asymptotic Analysis & Recurrences

Question 37, GATE 2011: Order these functions by increasing asymptotic growth: f1(n)=2^n; f2(n)=n^(3/2); f3(n)=n log2 n; f4(n)=n^(log2 n).

(A) f3,f2,f4,f1
(B) f3,f2,f1,f4
(C) f2,f3,f1,f4
(D) f2,f3,f4,f1
Tap to enlarge
Your answer
Answer & solution

Official answer: A

n log n grows slower than n3/2. The function nlog2 n=2^((log2 n)²) eventually exceeds every fixed power of n, but is smaller than 2n since(log2 n)²=o(n). Hence f3<f2<f4<f1 asymptotically, A.

Pairwise ratios justify the ordering beyond a few sample values. f3/f2=(log2 n)/√n tends to zero. Taking logarithms, log2(f4/f2)=(log2 n)²-(3/2)log2 n tends to infinity. Finally log2(f4/f1)=(log2 n)²-n tends to minus infinity. Thus the quasipolynomial sits above every fixed-degree polynomial but below the exponential. Finite small-n ties or reversals do not affect an asymptotic comparison.

Original paper, page 10 · Answer key

2 marks · MCQ
Report issue

Factorial versus exponential and quasipolynomial

Asymptotic Analysis & Recurrences

Question 39, GATE 2008: Let f(n)=2^n, g(n)=n!, h(n)=n^(log n). Which asymptotic statement is true?

(A) f=O(g); g=O(h)
(B) f=Ω(g); g=O(h)
(C) g=O(f); h=O(f)
(D) h=O(f); g=Ω(f)
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

1. Compare logarithms, which preserve growth order for positive functions. log h=(log n)² up to base constants; log f=Θ(n). Since (log n)²=o(n), h grows slower than f.
2. Stirling gives log(n!)=n log n−n+O(log n), which grows faster than n. Thus f grows slower than g.
3. Therefore h=O(f) and g=Ω(f), D.

Original paper, page 7

1 mark · MCQ
Report issue

Comparing polynomial and polylogarithmic factors

Asymptotic Analysis & Recurrences

Question 1.16, GATE 2001: Compare f(n)=n² lg n and g(n)=n(lg n)^10. Which asymptotic relationship holds: only f=O(g), only g=O(f), neither, or both?
Question 1.16, GATE 2001: Compare f(n)=n² lg n and g(n)=n(lg n)^10. Which asymptotic relationship holds: only f=O(g), only g=O(f), neither, or both?
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

Step 1: Divide f(n)=n² lg n by g(n)=n(lg n)10. The ratio is n/(lg n)9.

Step 2: Put t=lg n, so the ratio becomes 2t/t9, which tends to infinity because an exponential dominates every fixed power of t.

Therefore g=O(f), while f is not O(g), giving B. The logarithmic factor with exponent 10 cannot compensate asymptotically for the additional factor n in f.

Original paper, page 2

2 marks · MCQ
Report issue

Asymptotic comparison using logarithmic identities

Asymptotic Analysis & Recurrences

Question 2.17, GATE 2000: Let f(n)=3n^(√n),g(n)=2^(√n log2 n),h(n)=n!. Which is true: h=O(f),h=O(g),g is not O(f),or f=O(g)?
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

Step 1: Use 2log2 n=n to simplify g(n)=n√n. Hence f(n)=3g(n), so f and g are Θ-equivalent. This proves D and refutes the claim that g is not O(f).

Step 2: Factorial grows faster: n!≥(n/2)n/2, whose logarithm is(n/2)log(n/2), while log g=√n log n. Their ratio of logarithmic scales tends to infinity.

Thus h is neither O(f) nor O(g), leaving D.

Original paper, page 5