Back to Cosmos

README Bubble Sort

code/languages/Java/README_bubble-sort.md

latest419 B
Original Source

Bubble sort is an algorithm used to sort an array or a list in a more optimized fashion. At worst, bubble sort is seen as a 0(n^2) runtime sort algorithm.

Algorithm used:

  1. Check and see if the positions next to each other in the array/list are out of order.
  2. If they are, swap them. If not, move on.
  3. Do this through the entire list, if no swaps are made, end the algorithm.
  4. If changes have been made, repeat.