Visualising Sorts

This morning I was taking a break from work and watched the following video

And thought to myself, how would I go about doing something like that in python. Normally I dont do much in the way of graphics (beyond using things like matplotlib to make a pretty graph) so thought this would be a nice challenge.

So what did i use? I learnt just enough about the Tkinter python library to make a version of the animations in the video (for a badly implemented merge sort).

The code starts of by showing you the array of numbers its going to try and sort. Then as it performs a merge sort it first of all shows you which section its working on (black outlines) and how much it has sorted so far (red blocks)

Not much use but it was a bit of fun to play with for a while.

Share This:

Leave a Reply

Your email address will not be published. Required fields are marked *