Skip to content

Latest commit

 

History

History

Bubble Sort

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

Bubble Sort

Bubble sort is a sorting algorithm that is implemented by starting in the beginning of the array and swapping the first two elements only if the first element is greater than the second element. This comparison is then moved onto the next pair and so on and so forth. This is done until the the array is completely sorted. The smaller items slowly “bubble” up to the beginning of the array.

Runtime:
  • Average: O(N^2)
  • Worst: O(N^2)
Memory:
  • O(1)

Implementation:

The implementation will not be shown because as you can see from the average and worst runtimes this is a very inefficient algorithm but having a grasp of the concept will help in getting to know the basics of simple sorting algorithms.