Sound:
Speed:
Volume:
Items:
Radix base:
2
Audio delay:
About
This is my attempt at recreating the sorting algorithm visualization from The sound of sorting. By clicking ‘play’, you
will see every algorithm I made, and watch how each algorithm tackles the well-known problem of sorting
an array of randomized numbers, each in their own distinct way. By turning on the sound, you will also
be able to hear the pitch of each number the algorithm reads over. You can also shuffle and choose each
algorithm individually if you like. Do note however that pressing multiple algorithms at once will make
the algorithms mess up, and will turn the list into a mess.
Heavily inspired by this video
showcasing the algorithms in The sound of sorting.
For those who are interested in learning about
each algorithm, I would suggest watching this
video, since it has taught me a lot about
the mathematics behind each algorithm. For those looking for a short description of each algorithm,
continue reading.
Selection sort
From the first item, continuously searches for the
next item in the array and places it at the correct location until it is sorted.
Double
selection sort
Searches from both sides for the next lowest and next highest item, then
places those in the right location in the array until sorted.
Insertion sort
Places
each consecutive item in the array in the right place in the items before it until sorted.
Bubble sort
Compares each item from left to right with the next item, and if the next
item is lower, swaps the 2. It will keep going until the list is sorted.
Shaker
sort
Same as bubble sort but goes both from left to right and from right to left.
Quick sort
Checks the value on the first number, then places the numbers less than
that on the left, and the numbers more on the right, and then recursively does the same for both sides,
until the list is sorted.
Merge sort
Recursively splits the list in half, sorts both
sides, and then combines both sides by going through both lists at the same time
Heap
sort
Turns the list into a max heap, then continuously removes the first item of the list and rebuilds the heap
Comb sort
Similar to bubble sort, but with a
decreasing gap between the 2 compared items
Shell sort
Similar to insertion sort, but
with multiples of a certain number that decreases.
Radix sort (LSD)
Converts each
number to its value with a different base (like base 4 instead of base 10), then sorts the numbers by
each digit, starting from the last digit (the Least Significant Digit)
Radix sort
(MSD)
Similar to Radix sort LSD, but instead starts with the first digit (the Most
Significant Digit), and then recursively goes on to the next digit, from each sublist of items with the
same first digit.