What are advantages and disadvantages of Bubble Sort?

Technology CommunityCategory: SortingWhat are advantages and disadvantages of Bubble Sort?
VietMX Staff asked 3 years ago

Advantages:

  • Simple to understand
  • Ability to detect that the list is sorted efficiently is built into the algorithm. When the list is already sorted (best-case), the complexity of bubble sort is only O(n).

Disadvantages:

  • It is very slow and runs in O(n2) time in worst as well as average case. Because of that Bubble sort does not deal well with a large set of data. For example Bubble sort is three times slower than Quicksort even for n = 100