O(n log(n))

Just quicksort, mergesort and heapsort in a single image. I was obsessed with shrinking my code to fit in a single image :)

My helpful screenshot

For Reference, The best, average and worst complexities

Algorithm Best Average Worst  
Quicksort $\Omega(n\log{}n)$ $\Theta(n\log{}n)$ $O(n^2)$  
Mergesort $\Omega(n\log{}n)$ $\Theta(n\log{}n)$ $O(n\log{}n)$  
Heapsort $\Omega(n\log{}n)$ $\Theta(n\log{}n)$ $O(n\log{}n)$  

I went on to make this video right about that time in Processing which used the 3 $O(n^2)$ algorithms (selection,bubble,insertion) to sort randomly shuffled colours. Take a look!



Written by Atul Vinayak on 11 April 2013