Skip to content

Bubble sort algorithm is sorting numbers small to big. This is c++ example.

Notifications You must be signed in to change notification settings

muhammedkarakul/BubbleSortAlgorithm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

BubbleSortAlgorithm

Bubble sort is the simplest technique in which we compare every element with its adjacent element and swap the elements if they are not in order. This way at the end of every iteration (called a pass), the heaviest element gets bubbled up at the end of the list.

Complexity

Bubble sort has a worst-case and average complexity of О(n2), where n is the number of items being sorted.

Algorithm:

begin BubbleSort(list)

for all elements of list if list[i] > list[i+1] swap(list[i], list[i+1]) end if end for

return list

end BubbleSort

About

Bubble sort algorithm is sorting numbers small to big. This is c++ example.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages