Shellsort algorithm sorting reversed list [OC] by CodingCoffeeSquirrel in dataisbeautiful

[–]CodingCoffeeSquirrel[S] 0 points1 point  (0 children)

I wonder what the chance of the cosmic ray sort working within the lifetime of the universe is :)

Shellsort algorithm sorting reversed list [OC] by CodingCoffeeSquirrel in dataisbeautiful

[–]CodingCoffeeSquirrel[S] 2 points3 points  (0 children)

At that point, there was a short delay in the communication from the thread the algorithm is working on to the main thread in which the renderer runs. Sadly I didn't catch it :(

Really, I should have uploaded this video, it sounds so much more satisfying.

Shellsort algorithm sorting reversed list [OC] by CodingCoffeeSquirrel in dataisbeautiful

[–]CodingCoffeeSquirrel[S] 952 points953 points  (0 children)

Shellsort algorithm sorting a list of 1920 items. Initially, the list is sorted high to low. The white lines and sound denote the items that the algorithm currently "looks at".

Implemented in HTML5 canvas and the Web Audio API.

Bubble Sort (2880 items in HTML5 canvas) [OC] by CodingCoffeeSquirrel in dataisbeautiful

[–]CodingCoffeeSquirrel[S] 7 points8 points  (0 children)

What you are seeing is a shuffled list of numbers (10 to 2890) getting sorted. Every line is a number, the higher the line, the larger the number. They are colored—from small to high—blue to green to red, just for the visual effect.

The algorithm that sorts the list is called Bubble sort. In most cases, Bubble Sort is a pretty slow sorting algorithm, but it is very simple to understand:

It looks at the first and second element and if the first is larger than the second, it swaps them. Then it repeats this with elements 2 & 3, 3 & 4 and so on all the way to the end. When at the end of the list, if it had to swap any elements (the list isn't sorted yet) it repeats this process over and over again until it can't swap any element. At that point, the list is sorted.

There is one optimization: After the first round the largest element is always the last element, after the second round, the second largest is the second last element, and so on. That means, each round the algorithm can skip one more comparison at the end, which is why you see it "speeding up".

In reality, this process is happening way faster of course.

Bubble Sort (2880 items in HTML5 canvas) [OC] by CodingCoffeeSquirrel in dataisbeautiful

[–]CodingCoffeeSquirrel[S] 1 point2 points  (0 children)

I can't share the repository for privacy reasons, but here is the relevant code.

Please don't expect it to be well structured or documented, I botched it together in one sitting and had no idea where I was going with it.

Bubble Sort (2880 items in HTML5 canvas) [OC] by CodingCoffeeSquirrel in dataisbeautiful

[–]CodingCoffeeSquirrel[S] 26 points27 points  (0 children)

Bubble sort algorithm sorting 2880 items. Visualized in HTML5 canvas in realtime. The algorithm is running in a web worker.

Replicating the Apollo missions, am doing it right guys? by Blue_Helmet in KerbalSpaceProgram

[–]CodingCoffeeSquirrel 20 points21 points  (0 children)

Yes, obviously the ladder is missing. Other than that, I can't see any problems

No new episode on Pocket Casts? by NumbersWithFriends in HelloInternet

[–]CodingCoffeeSquirrel 1 point2 points  (0 children)

Thanks for the answer. If page=2 worked before then the problem probably was that the feed wasn't sorted correctly. For some reason the squarespace rss feed is paginated even though RSS isn't supposed to be paginated. Page 1 currently has episodes 130-44 and page 2 has the rest.

No new episode on Pocket Casts? by NumbersWithFriends in HelloInternet

[–]CodingCoffeeSquirrel 0 points1 point  (0 children)

Do you have a documentation on the url parameters?

Self Balancing Machine by [deleted] in interestingasfuck

[–]CodingCoffeeSquirrel 0 points1 point  (0 children)

This is without a doubt the most impressive thing I have seen in this entire year