r/Python • • Jan 08 '20

Visualizing Bubble Sort

Post image
2.1k Upvotes

73 comments sorted by

View all comments

1

u/iggy555 Jan 09 '20

What’s bubble sort?

2

u/Bisqutz Jan 09 '20

Bubble sort is a sorting algorithm for 'lists' it compares item a and b, if a is 'bigger' than b it swaps them around, then it will compare a with c (or b with c if b was bigger) and do the same all the way through the list until the biggest is at the end, it will then repeat this again and again putting the biggest at the end and then smaller and smaller, til the list is sorted.
Hope that made sense if not have a watch of this Tom Scott video he shows it nicely
https://www.youtube.com/watch?v=RGuJga2Gl_k