Algorithms and Data Structures · Junior · Question 73 of 75
An algorithm is O(n²). Roughly how much longer does it take when the input grows from 1,000 to 10,000 items?
- 1About the same
- ✓Correct answer: About 100 times longer
- 3About 10 times longer
Explanation
The input grew 10 times, so n² grew 10² = 100 times. For O(n) it would be about 10 times, for O(log n) just a few extra steps.