✏️ Explanatory Question

Reorder the following efficiencies from the smallest to the largest: (a) n·log2(n) (b) n + n2 + n3 (c) 24 (d) n0.5

👁 0 Views
📘 Detailed Answer
🟢 Easy
💡

Answer with Explanation

Ans. 24 < n0.5 < n·log2(n) < n + n2 + n3

💡 Explanation:

To arrange the expressions correctly, compare their growth rates as n becomes very large.

  • 24 = 16 is a constant. It does not increase with n, so it has complexity O(1) and is the smallest.
  • n0.5 = √n grows with n, but more slowly than a linear or log-linear expression.
  • n·log2(n) grows faster than √n, but slower than a cubic polynomial.
  • In n + n2 + n3, the highest-power term n3 dominates for large values of n. Therefore, the expression has complexity O(n3) and is the largest.

Therefore, the correct growth order is: constant → square root → log-linear → cubic .

Memory tip: O(1) < O(√n) < O(n log n) < O(n3)