Rajdeep Biswas
Rajdeep Biswas

Reputation: 307

Comparing bubble, selection and insertion sort efficiency

I have the following understanding - Both bubble and insertion sort have time complexities

While selection sort has all time complexities (best, avg and worse): (n^2)

Following this, here are my questions based on what I generally hear about these algorithms -

  1. Bubble sort is said to be the least efficient algorithm / considered at par with selection sort. Why so? (since i know, according the Ω, bubble sort is much better than selection.)
  2. Insertion sort is considered an improvement over bubble and selection sort. Why so exactly? (again, by the time complexities although I understand it is better than selection sort but it's also the EXACT same as bubble sort).

Upvotes: 0

Views: 1168

Answers (1)

Codrut
Codrut

Reputation: 1

As far as I know bubble sort is the worst in terms of efficiency, especially if you have reverse sorted lists or large lists. Best case for bubble sort is if almost the entire list is already sorted. You have to check the complexity of every algorithm on your case to figure out which one is the best.

Upvotes: -1

Related Questions