Skip to content

Latest commit

 

History

History

BubbleSort

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Algorithm

bubbleSort(array, n):
    for i = 1 -> n-1:
        for j = 1 -> n-i-1:
            if (array[j] > array[j+1]):
                swap(array[j], array[j+1])

Complexity

  • Time:
    • Worst Case: formula
    • Average Case: formula
    • Best Case: formula
  • Space:
    • Worst Case: formula