Enjoy!
Radix sort has a run time of d*n, where d is the number of digits and n is the number of items. With an overall O(n) it is MUCH faster than bubble sorts O(n^2)
For those who want to know how it works:
A lexicographic sort does this (radix is a type of lexicographic sort)
Step 1: sort list by least significant digit
Step 2: sort list by the next significant digit
repeat till most significant digit is sorted and bam! sorted!
radix sort just uses buckets to sort by decimal number. (0-9)
You could also use any other stable sort if you wanted
It's awesome to watch since it's like a surprise sort!
Also there is a little bit of code i wrote after having trouble with indexes. I don't know if there's something better out there but it works for me!