Skip to content

QueryCrew/P2-BubbleSort

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bubble Sort

Write a function to sort an array of n elements.

Bubble Sort:

Bubble sort, sometimes referred to as sinking sort, is a simple sorting algorithm that repeatedly steps through the list, compares adjacent elements and swaps them if they are in the wrong order. The pass through the list is repeated until the list is sorted. The time complexity is O(n²) in the average case.

Input:

arr = [2,1,6,4,9,7,5]

Output:

arr = [1,2,4,5,6,7,9]

Time Complexity:

O(n²)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 46.3%
  • JavaScript 25.1%
  • C++ 17.4%
  • Python 11.2%