Algorithms in Colour…Fun for the Whole Family!

Image for post
Image for post
The QuickSort algorithm in colour


So I ordered a couple of things from Amazon and off I went…

Things you will need

Step 1 — Choose an algorithm

For this demonstration, I will use a QuickSort algorithm, following this example:

Image for post
Image for post
QuickSort Algorithm (in its “boring form”)

Step 2 — Decide on the colour order

  • red
  • orange
  • yellow
  • light green
  • dark green
  • light blue
  • dark blue
  • purple
  • pink
Image for post
Image for post
Count and order the colours you need

Step 3— Position numbers on a card with a pencil

KABOOM! Sadly, I forgot to take a photo at this point, but I’m sure you can work out what needs to go where from the example!

Step 4 — Lay coloured stickers in order on the bottom row

Image for post
Image for post
Laying the first colour Red on the number -6

Step 5— Place each colour in its other spots

For example: the furthest most left colour is red, which was placed on the number -6. This means we must place a red sticker everywhere that we see a -6.

In my final picture, there’s another row along the bottom, which just reiterates the order of the colours as it looks nicer.

Image for post
Image for post
Placing colours on the appropriate numbers

Step 6 — Mark the pivoting numbers

More information on what a pivot is can be found in this really good article written by another Medium blogger.

In the example I’m following, the first pivot selected was Green (no. 3).

Image for post
Image for post
Define the First Pivot

Written by

George is a software engineer, author, blogger, and tech enthusiast who believes in helping others to make us happier and healthier.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store