Sorting Algorithms

Sorting Algorithms are methods of reorganizing a large number of items into some specific order such as highest to lowest, or vice-versa, or even in some alphabetical order.

These algorithms take an input list, processes it (i.e, performs some operations on it) and produce the sorted list.

The most common example we experience every day is sorting clothes or other items on an e-commerce website either by lowest-price to highest, or list by popularity, or some other order.

Types of Sorting Algorithms:

  1. Quick Sort
  2. Bubble Sort
  3. Merge Sort
  4. Insertion Sort
  5. Selection Sort
  6. Heap Sort
  7. Radix Sort
  8. Bucket Sort

Time Complexities of Sorting Algorithms:

Algorithm Best Average Worst
Quick Sort Ω(n log(n)) Θ(n log(n)) O(n^2)
Bubble Sort Ω(n) Θ(n^2) O(n^2)
Merge Sort Ω(n log(n)) Θ(n log(n)) O(n log(n))
Insertion Sort Ω(n) Θ(n^2) O(n^2)
Selection Sort Ω(n^2) Θ(n^2) O(n^2)
Heap Sort Ω(n log(n)) Θ(n log(n)) O(n log(n))
Radix Sort Ω(nk) Θ(nk) O(nk)
Bucket Sort Ω(n+k) Θ(n+k) O(n^2)

 

Serious about Learning Programming ?

Learn this and a lot more with Scaler Academy's industry vetted curriculum which covers Data Structures & Algorithms in depth.

Arrays Problems

Value ranges
Problem Score Companies Time Status
Max Min 150
17:31
Merge Intervals 225 78:57
Merge Overlapping Intervals 225 48:24
Arrangement
Hash search
Problem Score Companies Time Status
Occurence of Each Number 200 28:07
Space recycle
Problem Score Companies Time Status
Set Matrix Zeros 300 48:04
Maximum Sum Square SubMatrix 300 58:30
lock
Topic Bonus
Bonus will be unlocked after solving min. 1 problem from each bucket