Which of the given options provides the increasing order of asymptotic…

2021

Which of the given options provides the increasing order of asymptotic complexity of functions \(f1, f2, f3\) and \(f4\) ?

A. \(f1(n) = 2^n\)

B. \(f2(n) = n^{3/2}\)

C. \(f3(n) = n \ log \ n\)

D. \(f4(n) = n^{log \ n}\)

Choose the correct answer from the options given below

  1. A.

    C, B, D, A

  2. B.

    C, B, A, D

  3. C.

    B, C, A, D

  4. D.

    B, C, D, A

Attempted by 287 students.

Show answer & explanation

Correct answer: A

Key insight: compare growth rates by taking logarithms or using standard o(.) relations.

  • Definitions: f1(n)=2^n, f2(n)=n^{3/2}, f3(n)=n log n, f4(n)=n^{log n}.

  • Compare f3 and f2:

    f3(n)/f2(n) = (n log n) / n^{3/2} = (log n) / n^{1/2}, which → 0 as n → ∞. So f3 grows slower than f2 (f3 = o(f2)).

  • Compare f2 and f4:

    Take logarithms: log(f2)= (3/2) log n, while log(f4)= (log n)^2. Since (log n)^2 grows faster than log n, f4 grows faster than any fixed polynomial n^k. Thus f2 = o(f4).

  • Compare f4 and f1:

    Write f4 = n^{log n} = 2^{(log n)^2}, while f1 = 2^n. Because (log n)^2 = o(n), we have 2^{(log n)^2} = o(2^n). So f4 grows slower than f1.

  • Combine the comparisons to get the increasing order:

    f3(n) = n log n < f2(n) = n^{3/2} < f4(n) = n^{log n} < f1(n) = 2^n

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Coding For Placement