Skip to content

UpperLEFTY/bubblesort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 

Repository files navigation

bubblesort

Step 1: Compare the first item with the second item. If the first item is bigger than the second item. Swap them so that the bigger one stays in the second position.

Step 2: Compare second with third itemif second item is bigger than the third, Swap them. Hence, the biggest among first three is in the third position.

Step 3: Keep doing it, until you hit the last element of the array. In that way you bubble up the biggest item of the array to the right most position of the array.

step 4: Look at the inner loop in the code below.

Step 5: We repeat this process, starting from the last item of the array. look at the outer loop in the code below. Do this way, so that after finishing the first inner loop, the biggest one will be in the last item of the array.

Step 6: Move backward inside the outer loop.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published