Sorting Algorithm Visualizations

I made a project that visualizes various sorting algorithms. I got this idea from the fact that my school's cs course is talking about insertion sort. And because of helicoptur.

I made a neat thing -- it uses continuations to pause the algorithm, draw the graph, and then resume the sorting algorithm on the next frame. This way I didn't have to create a sorter class to store its state, or create a call stack for the recursive algorithms.

It took fewer comparisons to do mergesort on 1000 items than it did bubble sort on 100. (8655 vs. 9009)

Hi, haven't seen you in a while.

This is a great project. And yes, that's a clever use of continuations!

There's a bug, though. In bogosort, you left out a SET (VALUES) TO (LIST). (Why is that a global variable?)

You can speed up SHUFFLE by doing PICK RANDOM (I) TO (LENGTH OF (INP)) instead of starting at 1. Values to the left of I are already in a randomly chosen position.

I've been here, kind of. I check here sometimes but usually don't say anything.

The reason the values variable exists is because I was trying to add sound like in those sorting algorithm YouTube videos. I was gonna make it play a frequency by taking the average of all the values processed each frame, but it didn't seem right, so I just gave up on it for now. I don't know how those videos determined which frequency to play.

Also I'm not sure if that optimization in the shuffle method would even make it faster. It just decreases the range of the random number. But you know I should make it an in-place command block. I forgot why I made it a reporter but I didn't want to accidentally break anything.

I keep convincing myself that your version doesn't do a fair shuffle, with all outcomes equally likely, and then unconvincing myself. I just know that my version is what's in Knuth. :~) And, reporters are good. ;~)

I like it !

i keep the bogo sort to shuffle my lists ! hahaha