DEV Community


Posted on

Visualizing Bubble sort algorithm in python using pygame.

Hello geeks,
I presume that this is my second or third post on this forum, so I do apologize for any errors.

Today we are going to visualize bubble sort algorithm in Python. Bubble sort is the simplest sorting algorithm that works by swapping adjacent elements in a list if they are not in the correct order. The time complexity of the bubble sort algorithm is O(n2) and the space complexity for Bubble sort is O(1) because only a single additional memory space is required.

Enough about the wordy part of it. Let us get into the tasty stuff...

Alt Text

And more...
Alt Text

I am sorry I didn't add comments to my code. Also, code reviews are welcome and constructive criticism.
You can follow me in Github through this link link

Discussion (0)