Skip to content

About

Sorting Algorithm To Sort An Array

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

10 Commits

Folders and files

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

Sorting Algorithm To Sort An Array

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages