Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Bubble Sort

Bubble sort is a simple sorting algorithm. This sorting algorithm is comparison-based algorithm in which each pair of adjacent elements is compared and the elements are swapped if they are not in order. This algorithm is not suitable for large data sets as its average and worst case complexity are of Ο(n2) where n is the number of items.

Input Format

First line contains the number of elements in the array. Second line contains the elements of the array.

Output Format

Output of one line containing sorted array

Sample Input

8
30 52 29 87 63 27 19 54

Sample Output

19 27 29 30 52 54 63 87

Implemented in:

  • Python
  • [C++] (bubble_sort.cpp)