r/Python • • Jan 08 '20

Visualizing Bubble Sort

Post image
2.1k Upvotes

73 comments sorted by

View all comments

1

u/[deleted] Jan 08 '20

Such an interesting way to visualize sorting alogorthms! Screw those animations, this looks much cleaner and gives you a good understanding about how the algorithm works.

21

u/[deleted] Jan 08 '20

No offense to op, the image looks beautiful. But I know how bubble sort works, I can easily code it, but I don't understand shit from this visualization.

2

u/JakubBlaha Jan 08 '20

I guess on the left side you ve got the shuffled sequence and on the right side there is the sorted sequence. The item values is represented as a color and the horizontal steps are the states of the array each after completing a one inner loop iteration. The lines are there just to visualize how the items travel through the array.

2

u/[deleted] Jan 08 '20

Ohhh I see it now. Thanks!