Created
October 2, 2017 06:33
-
-
Save thebopshoobop/7d227ce4dcc0b1a46b3a89927af57dfd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Start with an unsorted array | |
[95, 93, 36, 74, 33] | |
// Place them in the appropriate buckets for the least significant digit | |
{3: [93, 33], 4: [74], 5: [95], 6: [36]} | |
// And extract them back into an array | |
[93, 33, 74, 95, 36] | |
// Repeat for the next significant digit | |
{3: [33, 36], 4: [43], 7: [74], 9: [93, 95]} | |
// And we're Sorted! | |
[33, 36, 43, 74, 93, 95] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment