Computer Science I / Sorting Strategies
Practice question · Sort into groups

Sort each sorting algorithm by its typical asymptotic cost.

Groups: Quadratic O(n^2) · Linearithmic O(n log n)

Hints
  1. The three 'simple sorts' are quadratic; the efficient sorts are linearithmic.
  2. Merge, quick (average), and heap are the O(n log n) family.
Show the answer

Quadratic O(n^2): Bubble sort, Selection sort, Insertion sort

Linearithmic O(n log n): Merge sort, Quicksort (average case), Heapsort

Why

Bubble, selection, and insertion are the simple O(n^2) sorts; merge, quicksort (on average), and heapsort are the efficient O(n log n) sorts real systems use for large data.

Read the lesson: Sorting Strategies →

Practise Sorting Strategies

The app has 5 more questions on this lesson, and keeps your place in the course. Computer Science I is free to start.

More questions on Sorting Strategies