**When will you choose an algorithm whose time complexity is O(n^2) instead of the other one whose time complexity is O(n)?**

1.When n is small, O(n^2) could be smaller than O(n) or they do not differ much.

2. When time is not a concern and O(n^2) is easy to program.

3. When space complexity is a concern and O(n^2) consume less space.

### Like this:

Like Loading...

*Related*