1. Gyanastra
  2. Algorithms
  3. Growth Rates, Comparing Functions and Asymptotic Notation Tricks
  4. Ten fully worked GATE-style ordering questions
Free lesson, no account needed 8 min read
Asked in past papers7 times
  • GATE CSE2026202120172011200820012000

Algorithms · Growth Rates, Comparing Functions and Asymptotic Notation Tricks

Ten fully worked GATE-style ordering questions

In each, arrange in increasing order of growth (slowest first). Every step is shown.

Q1. n, log⁡n, nlog⁡n, n2, 2n, log⁡log⁡n, 1n,\ \log n,\ n\log n,\ n^2,\ 2^n,\ \log\log n,\ 1

Compare pairwise using the ladder. log⁡log⁡n\log\log n grows without bound but slower than log⁡n\log n (since log⁡log⁡n/log⁡n→0\log\log n/\log n\to 0). 11 is constant. Chain: 1≺log⁡log⁡n≺log⁡n≺n≺nlog⁡n≺n2≺2n.1 \prec \log\log n \prec \log n \prec n \prec n\log n \prec n^2 \prec 2^n. Check the two nontrivial links: n/(log⁡n)→∞n/(\log n)\to\infty ✓; nlog⁡n/n2=log⁡n/n→0n\log n/n^2=\log n/n\to 0 ✓.

Q2. n, log⁡3n, n0.1, 2log⁡n\sqrt{n},\ \log^3 n,\ n^{0.1},\ 2^{\sqrt{\log n}}

All four are sub-linear or near-linear; compare via exponents base 2.

  • n=n1/2=212log⁡n\sqrt n = n^{1/2}=2^{\frac12\log n}.
  • log⁡3n=23log⁡log⁡n\log^3 n = 2^{3\log\log n}.
  • n0.1=20.1log⁡nn^{0.1}=2^{0.1\log n}.
  • 2log⁡n=2(log⁡n)1/22^{\sqrt{\log n}}=2^{(\log n)^{1/2}}.

Compare exponents: 3log⁡log⁡n3\log\log n vs (log⁡n)1/2(\log n)^{1/2} vs 0.1log⁡n0.1\log n vs 0.5log⁡n0.5\log n.

  • 3log⁡log⁡n=o((log⁡n)1/2)3\log\log n = o((\log n)^{1/2}): ratio =3log⁡log⁡n(log⁡n)1/2→0=\dfrac{3\log\log n}{(\log n)^{1/2}}\to 0 (log grows slower than any positive power). So log⁡3n≺2log⁡n\log^3 n \prec 2^{\sqrt{\log n}}.
  • (log⁡n)1/2=o(log⁡n)(\log n)^{1/2}=o(\log n), and 0.1log⁡n<0.5log⁡n0.1\log n<0.5\log n, so 2log⁡n≺n0.1≺n2^{\sqrt{\log n}}\prec n^{0.1}\prec \sqrt n.

Order: log⁡3n≺2log⁡n≺n0.1≺n.\log^3 n \prec 2^{\sqrt{\log n}} \prec n^{0.1} \prec \sqrt n. (Sanity: log⁡3n\log^3 n is polylog; 2log⁡n2^{\sqrt{\log n}} is "quasi-polylog", bigger than any polylog; n0.1n^{0.1} and n0.5n^{0.5} are polynomial.)

Q3. nlog⁡nn^{\log n} vs 2n2^n vs nlog⁡log⁡nn^{\log\log n}

Rewrite base 2:

  • nlog⁡n=2(log⁡n)2n^{\log n}=2^{(\log n)^2}.
  • 2n=2n2^n=2^{n}.
  • nlog⁡log⁡n=2log⁡n⋅log⁡log⁡nn^{\log\log n}=2^{\log n\cdot\log\log n}.

Compare exponents: (log⁡n)2(\log n)^2 vs log⁡nlog⁡log⁡n\log n\log\log n vs nn.

  • log⁡nlog⁡log⁡n=o((log⁡n)2)\log n\log\log n = o((\log n)^2) (ratio =log⁡log⁡n/log⁡n→0=\log\log n/\log n\to 0). So nlog⁡log⁡n≺nlog⁡nn^{\log\log n}\prec n^{\log n}.
  • (log⁡n)2=o(n)(\log n)^2=o(n) (polylog vs linear). So nlog⁡n≺2nn^{\log n}\prec 2^n.

Order: nlog⁡log⁡n≺nlog⁡n≺2nn^{\log\log n}\prec n^{\log n}\prec 2^n.

Q4. 2log⁡n2^{\sqrt{\log n}} vs (log⁡n)log⁡n(\log n)^{\log n} vs nn

  • 2log⁡n=2(log⁡n)1/22^{\sqrt{\log n}}=2^{(\log n)^{1/2}}.
  • (log⁡n)log⁡n=2log⁡n⋅log⁡log⁡n(\log n)^{\log n}=2^{\log n\cdot\log\log n}.
  • n=2log⁡nn=2^{\log n}.

Exponents: (log⁡n)1/2(\log n)^{1/2} vs log⁡nlog⁡log⁡n\log n\log\log n vs log⁡n\log n. Since (log⁡n)1/2=o(log⁡n)(\log n)^{1/2}=o(\log n) and log⁡n=o(log⁡nlog⁡log⁡n)\log n=o(\log n\log\log n): 2log⁡n≺n≺(log⁡n)log⁡n.2^{\sqrt{\log n}}\prec n\prec (\log n)^{\log n}. Note (log⁡n)log⁡n(\log n)^{\log n} is super-polynomial (bigger than nkn^k for every fixed kk) yet sub-exponential (smaller than 2ne2^{n^e} for every e>0e>0). Good trap.

Q5. n1/log⁡nn^{1/\log n} vs log⁡n\log n vs 11

Rewrite: n1/log⁡n=2(1/log⁡n)⋅log⁡n=21=2n^{1/\log n}=2^{(1/\log n)\cdot\log n}=2^{1}=2. So n1/log⁡n=Θ(1)n^{1/\log n}=\Theta(1), a constant (equal to 2 if the log⁡s\log s share a base; in general it equals the base, hence Θ(1)\Theta(1) regardless). Therefore: n1/log⁡n=Θ(1)≺log⁡n.n^{1/\log n}=\Theta(1)\prec \log n. This is the classic "looks scary, is constant" question.

Q6. log⁡(n!)\log(n!) vs nlog⁡nn\log n vs n2n^2 vs 2n2^n

Stirling: log⁡(n!)=Θ(nlog⁡n)\log(n!)=\Theta(n\log n). So log⁡(n!)\log(n!) and nlog⁡nn\log n are Θ\Theta-equal (write them as one class). Then nlog⁡n≺n2≺2nn\log n\prec n^2\prec 2^n. Order: log⁡(n!) ≈ nlog⁡n ≺ n2 ≺ 2n.\log(n!)\ \approx\ n\log n\ \prec\ n^2\ \prec\ 2^n. If the question forces a strict order between log⁡(n!)\log(n!) and nlog⁡nn\log n: log⁡(n!)=nlog⁡n−nlog⁡e+O(log⁡n)\log(n!)=n\log n - n\log e+O(\log n), so log⁡(n!)\log(n!) is slightly smaller but same Θ\Theta class — GATE treats them as equal.

Q7. n!n! vs 2n2^n vs nnn^n vs 22n2^{2^n}

  • n!/2n=∏i=1n(i/2)n!/2^n=\prod_{i=1}^n (i/2). For i≥3i\ge 3 each factor >1>1, so the product →∞\to\infty: 2n≺n!2^n\prec n!.
  • n!/nn=∏i=1n(i/n)≤1n!/n^n=\prod_{i=1}^n (i/n)\le 1 and in fact →0\to 0 (Stirling: n!≈(n/e)n2πnn!\approx (n/e)^n\sqrt{2\pi n}, ratio to nnn^n is 2πn/en→0\sqrt{2\pi n}/e^n\to 0): n!≺nnn!\prec n^n.
  • 22n2^{2^n} vs nnn^n: take log⁡s\log s. log⁡(22n)=2n\log(2^{2^n})=2^n. log⁡(nn)=nlog⁡n\log(n^n)=n\log n. Since nlog⁡n=o(2n)n\log n=o(2^n), we get nn≺22nn^n\prec 2^{2^n}.

Order: 2n≺n!≺nn≺22n2^n\prec n!\prec n^n\prec 2^{2^n}.

Q8. log⁡∗n\log^* n vs log⁡log⁡n\log\log n vs log⁡n\log n

log⁡∗n\log^* n = number of times to apply log⁡2\log_2 before the value drops to ≤1\le 1. For n=216=65536n=2^{16}=65536: log⁡265536=16\log_2 65536=16, log⁡216=4\log_2 16=4, log⁡24=2\log_2 4=2, log⁡22=1\log_2 2=1 — four applications, so log⁡∗65536=4\log^* 65536=4 (books differ by an additive constant in the convention; this never changes the Θ\Theta class). Since log⁡∗n\log^* n grows slower than log⁡log⁡n\log\log n (applying log⁡\log repeatedly reaches 1 far sooner than one log⁡log⁡\log\log), and log⁡log⁡n≺log⁡n\log\log n\prec\log n: log⁡∗n≺log⁡log⁡n≺log⁡n.\log^* n\prec \log\log n\prec \log n.

Q9. ∑i=1ni2\sum_{i=1}^n i^2 vs ∑i=1n2i\sum_{i=1}^n 2^i vs ∑i=1nlog⁡i\sum_{i=1}^n \log i vs ∑i=1n1i\sum_{i=1}^n \frac1i

  • ∑i2=Θ(n3)\sum i^2=\Theta(n^3) (power rule, k=2k=2).
  • ∑2i=2n+1−1=Θ(2n)\sum 2^i=2^{n+1}-1=\Theta(2^n).
  • ∑log⁡i=log⁡(n!)=Θ(nlog⁡n)\sum\log i=\log(n!)=\Theta(n\log n).
  • ∑1i=Hn=Θ(log⁡n)\sum \frac1i=H_n=\Theta(\log n).

Order: Θ(log⁡n)≺Θ(nlog⁡n)≺Θ(n3)≺Θ(2n)\Theta(\log n)\prec\Theta(n\log n)\prec\Theta(n^3)\prec\Theta(2^n), i.e. ∑1i ≺ ∑log⁡i ≺ ∑i2 ≺ ∑2i.\sum\tfrac1i\ \prec\ \sum\log i\ \prec\ \sum i^2\ \prec\ \sum 2^i.

Q10. Mixed bag: n0.5, 2log⁡n, nlog⁡n, log⁡(n!), n1.5, 22nn^{0.5},\ 2^{\log n},\ n\log n,\ \log(n!),\ n^{1.5},\ 2^{2n}

  • 2log⁡n=n2^{\log n}=n (since 2log⁡2n=n2^{\log_2 n}=n; with another base it is n1/log⁡2bn^{1/\log_2 b}, still Θ(n)\Theta(n) only if base is 2 — careful: 2log⁡n2^{\log n} with log⁡=log⁡2\log=\log_2 equals nn; with log⁡=ln⁡\log=\ln it equals nln⁡2≈n0.693n^{\ln 2}\approx n^{0.693}). GATE's default is base 2, so treat 2log⁡n=n2^{\log n}=n.
  • n0.5=nn^{0.5}=\sqrt n.
  • n1.5n^{1.5}.
  • nlog⁡nn\log n and log⁡(n!)\log(n!) are Θ\Theta-equal.
  • 22n=4n2^{2n}=4^n.

Order: n≺n=2log⁡n≺nlog⁡n≈log⁡(n!)≺n1.5≺4n=22n\sqrt n\prec n=2^{\log n}\prec n\log n\approx\log(n!)\prec n^{1.5}\prec 4^n=2^{2n}.


Typical GATE question patterns

PatternOne-line method
"Arrange in increasing order"Rewrite all as 2(⋅)2^{(\cdot)} or n(⋅)n^{(\cdot)}; compare exponents.
"Which is Θ\Theta of which"Limit test f/gf/g; finite nonzero ⇒Θ\Rightarrow\Theta.
"True/False about O,Ω,oO,\Omega,o"Check the quantifier: OO = some cc, oo = every cc.
"Is 2f=O(2g)2^{f}=O(2^{g}) given f=O(g)f=O(g)?"No in general; only if f−gf-g is bounded above.
"Value of log⁡(n!)\log(n!)"Stirling: Θ(nlog⁡n)\Theta(n\log n).
"Sum of series"Identify arithmetic / geometric / harmonic / power; apply table.
"Nested loop count"Evaluate inner sum, then outer; power rule.
"Which grows fastest/slowest"Ladder + log-of-both-sides for the odd ones.
"log⁡∗n\log^* n / iterated log"Count repeated log⁡\log applications; it is o(log⁡log⁡n)o(\log\log n).
"Base change"log⁡an=log⁡bn/log⁡ba\log_a n=\log_b n/\log_b a; base irrelevant in Θ\Theta.

Worked "is this statement true" drills

D1. True or false: n1/log⁡n=O(1)n^{1/\log n}=O(1)? True — it equals a constant (Q5).

D2. True or false: 2n+1=O(2n)2^{n+1}=O(2^n)? True: 2n+1=2⋅2n2^{n+1}=2\cdot 2^n, constant factor 2.

D3. True or false: 22n=O(2n)2^{2n}=O(2^n)? False: ratio =2n→∞=2^n\to\infty, so 22n=ω(2n)2^{2n}=\omega(2^n).

D4. True or false: if f=O(g)f=O(g) then f2=O(g2)f^2=O(g^2)? True: f≤cg⇒f2≤c2g2f\le cg\Rightarrow f^2\le c^2g^2.

D5. True or false: if f=O(g)f=O(g) then f=O(g)\sqrt f=O(\sqrt g)? True for non-negative functions: take square roots of f≤cgf\le cg, get f≤cg\sqrt f\le\sqrt c\sqrt g.

D6. True or false: n!=O(nn)n!=O(n^n)? True (Q7). Is nn=O(n!)n^n=O(n!)? False.

D7. True or false: log⁡(n!)=Ω(nlog⁡n)\log(n!)=\Omega(n\log n)? True (Stirling gives Θ\Theta).

D8. True or false: f=o(g)⇒f=O(g)f=o(g)\Rightarrow f=O(g)? True (strict implies non-strict). Converse false: f=nf=n, g=ng=n.

D9. True or false: f=Θ(g)⇒2f=Θ(2g)f=\Theta(g)\Rightarrow 2^f=\Theta(2^g)? False in general: f=2nf=2n, g=ng=n are Θ\Theta-equal but 2f=4n2^f=4^n, 2g=2n2^g=2^n, not Θ\Theta-equal. (It is true if f−gf-g is bounded.)

D10. True or false: ∑i=1nik=Θ(nk+1)\sum_{i=1}^n i^k=\Theta(n^{k+1}) for k=0k=0? True: ∑1=n=Θ(n0+1)\sum 1=n=\Theta(n^{0+1}).


Pages 1–2 of 2