Question:

Order the following complexities in the increasing order: $ O(n^2), O(n^3), O(\log n), O(n \log n) $

Show Hint

When comparing algorithmic complexities, remember that logarithmic growth is slower than linear growth, which is slower than quadratic and cubic growth.
Updated On: May 3, 2025
  • \( O(n^2), O(n^3), O(\log n), O(n \log n) \)
  • \( O(n^3), O(\log n), O(n \log n), O(n^2) \)
  • \( O(\log n), O(n \log n), O(n^2), O(n^3) \)
  • \( O(\log n), O(n^2), O(n \log n), O(n^3) \)
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is C

Solution and Explanation

When comparing time complexities, we order them based on their growth rate as the input size \( n \) increases. \( O(\log n) \) grows the slowest, followed by \( O(n \log n) \), then \( O(n^2) \), and \( O(n^3) \) grows the fastest.
Thus, the correct order is \( O(\log n), O(n \log n), O(n^2), O(n^3) \).
Thus, the correct answer is \( O(\log n), O(n \log n), O(n^2), O(n^3) \).
Was this answer helpful?
0
0