This is a project for visualisations of different sorting algorithms. It uses 481 elements (one for each X position). Algorithms: 1. Bubble Sort. Sorts first and second elements, then second and third, and so on. Repeat until list sorted. 2. Insertion Sort. Like Bubble Sort, but teleports elements into a 'sorted' part. 3. Quick Sort. Defines a random point as a partition, then sorts everything below that point to the left, and everything above it to the right. Calls a smaller Quick Sort again for each of the smaller lists. This is the most efficient sorting algorithm known to humanity! 4. reproductive body parttail Shaker Sort. Like Bubble Sort, but shakes up the list instead. 5. reproductive body parttail Ninja Sort. Invented by me. Like reproductive body parttail Shaker, but instead of being like Bubble Sort, it's like Insertion Sort. 6. Bogo Sort. Randomly shuffles list until it's sorted. Unless you're extremely lucky, it won't sort it until after the heat death of the universe. But it makes nice music! *Music is actually random piano notes, apparently played in ominous-sounding ear-numbing chords. 7. I was trying to make Radix LSD Sort, but... It apparently sorts the list into a beautiful fractal. But hey, it looks satisfying while doing it! (You can see the bug, where it gets flipped over, and seems to do all sorts of strange things). 8. Selection Sort. This is like Insertion sort, except it first puts the smallest element into the first position, then the second-smallest into the second position, until it's all sorted. Recommended to listen with headphones. It sounds satisfying, too. 9. An extremely laggy implementation of Comb Sort. I'm trying to fix it, and it DOES seem to work, but the larger comb-throughs are extremely laggy. I found it on Wikipedia, didn't understand some of the explanation or it's obscure use of words like, 'Turtle', but after looking at the animation approximately thrice, I understood it and started programming it. It was just a modified Bubble Sort, and could work on the extremely narrowly defined, simple abstraction of a list. A Python implementation was shown, but I think my system's more concise. Speeds (not rendering the lists, just brute-forcing it with the setting, though this may be too biased) (in seconds): Bubble Sort: 1.309. Insertion Sort: 0.297. #See how much shorter it is? In reality, it's more than this, but I think some of the processes made it more biased. Quick Sort: 0.573. should be faster, but my implementation apparently has an off-by-one error, so it leaves some outliers, but covers it up by Insertion Sorting it afterwards. reproductive body parttail Shaker Sort: Warnings: -Unless you have a huge amount of time, DON'T USE BUBBLE SORT ON A REVERSED LIST. It's painful to watch it struggle.
This works much better on Sulfurous! https://sulfurous.aau.at/#237940302 Changelog: v1.4.0: -Added Comb Sort and Selection Sort! -Completely changed some of the underlying systems with things like rendering. This is leading up to something huge, I assure you. v1.3.0: -Added PIANO MUSIC corresponding to elements being moved! You can thank me later. *Everything burns down.* -Algorithms can now 'Select' (highlight) elements that they do something interesting with. v1.2.0: -Fixed Quick Sort! It doesn't quite sort the list in reality, but it's so good, we let it off. -Added Cocktail Ninja Sort. -Added more options. v1.1.0: -Quick Sort no longer crashes! IT WAS RUNNING WITHOUT SCREEN REFRESH. -Added reproductive body parttail Shaker Sort. v1.0.0: -Made it work. -Published. I credit myself entirely, unless someone else wants to add sorting algorithms.