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.
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
Top Questions on Computer Languages and Algorithms