Timsort - a study in grayscale
28 January 2010
A couple of days ago I published a set of explosion-in-a-crayola-factory colourful sorting algorithm visualisations, using a colour sequence generated with the Hilbert curve. The idea was that using a space-filling curve to traverse the RGB colour cube we could get a large number of distinct but visually ordered colours. I contrasted this with a more common method, which is to vary the intensity of a monotone to generate a gradient of colours. A couple of people suggested that I provide a set of grayscale images for comparison. I was curious about this too, so I hacked a grayscale generator into sortvis. The results were striking, but not interesting enough to reproduce here in full. Subjectively, I think the coloured images do allow you to follow more of the detail in these dense visualisations, but I'm not wedded to the idea. Being able to visually judge the order of elements in a sorting algorithm visualisation is important, and that is something we sacrifice in the Hilbert RGB traversal. I still like my earlier sparse grayscale visualisations best.
If you're curious, you can check out sortvis and generate the full set of grayscale graphs with the following command:
./dense -g -n 512
I did think the grayscale version of Python's Timsort was worth sharing. It's pretty spectacular due to a purely coincidental 3d effect - not much good for explaining Timsort, but I'd hang it on my wall, for sure.
Related:
- Visualising Sorting Algorithms: Python's timsort 08 Aug 2009
- sortvis.org 14 Jul 2010
- Sortvis updates 01 Apr 2010
- Visualising Sorting Algorithms 27 Apr 2007
- Hilbert Curve + Sorting Algorithms + Procrastination = ? 26 Jan 2010
More posts:
- cryp.sr - the next step 17 Jun 2010
- Apple, China and the war of ideas 07 May 2010
- cryp.sr - a minimal host-proof cryptographic textpad 29 Mar 2010
- Host-proof applications: doing it wrong 26 Feb 2010
- Introducing mitmproxy: an interactive man-in-the-middle proxy 16 Feb 2010
- An email to the authors of JSCrypto 14 Jan 2010
- Generating colour maps with space-filling curves 07 Jan 2010
- Portrait of the Hilbert curve 03 Jan 2010