Skip to content

digitalmojo25/itp-w1-bubble-sort

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

[itp-w1] Bubble Sort

This project is to reproduce a sorting algorithm called a "bubble sort" using simple control flow structures. You will need to use nested loops to achieve this:

Read about bubble sort here: https://en.wikipedia.org/wiki/Bubble_sort

For a visual: https://upload.wikimedia.org/wikipedia/commons/c/c8/Bubble-sort-example-300px.gif

It goes through and checks if a number in the list is higher than the next number. If so, it switches the two. It does this until all the numbers are in increasing order.

Do not use the .sort or the .sorted method to do this.

>>> bubble_sort([1, 3, 2, 6, 5])
[1, 2, 3, 5, 6]
>>> bubble_sort([3, 2, 1])
[1, 2, 3]

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 77.0%
  • Makefile 23.0%