Overview of Sorting Algorithms

Here's a quick summary of the time complexity of sorting algorithms.

Now that we’ve gone over how most famous and important sorting algorithms work, here’s a quick table that you can refer to when you are solving coding problems.

Insertion Sort Selection Sort Merge Sort Quick Sort Bubble Sort Insertion Sort
Best Case Ω(n)(n) Ω(n2)(n^2) Ω(nlog(n)) Ω(nlog(n)) Ω(n2)(n^2) Ω(n)(n)
Average Case θ(n2)(n^2) θ(n2)(n^2) θ(nlog(n)) θ(nlog(n)) θ(n2)(n^2) θ(n2)(n^2)
Worst Case O(n2)O(n^2) O(n2)O(n^2) O(nlog(n))O(nlog(n)) O(n2)O(n^2) O(n2)O(n^2) O(n2)O(n^2)

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.