Algorithms and Data Structures · Junior · Question 38 of 75
What is the typical time complexity of a good general-purpose comparison sort?
- ✓Correct answer: O(n log n)
- 2O(n)
- 3O(n²)
Explanation
Merge sort, heapsort and Timsort (used by V8) run in O(n log n). Simple sorts such as bubble, selection and insertion sort are O(n²) in the worst case.