Bookmarked but guessing I will never use it again but who knows if I ever need to do another leet code test this would be a good resource for sorting. This could be useful for those of you that are still in college to have one of those aha moments when it comes to the sorting algorithms you are learning about. If you are going to look at the code, go to src -> lib -> sort-algorithms to see how they are implemented. Note the asterisk after the function* keyword which signifies a generator function.
Quicksort is best for randomized data. In fact, the best way to guarantee good performance from quicksort is to shuffle the data first! Well, it is theoretically possible that shuffling might yield a valley or other unlucky input, but the odds of that are O(1/n!) .
It requires O(N) memory, but since it is not a comparison sort, it also sorts in O(N). But it can only sort integers. So not exactly an apples-to-apples comparison.
https://communities.sas.com/t5/Graphics-Programming/Fun-With...
Demo https://xosh.org/VisualizingSorts/sorting.html
Post https://xosh.org/sorting-algorithms-visual-comparison/
Imgur gallery I was trying to replicate https://imgur.com/a/voutF
This also let you try out your own sorting algorithm too btw and share that in url. For example this algo https://xosh.org/VisualizingSorts/sorting.html#IYZwngdgxgBAZ... which was discussed at the time https://news.ycombinator.com/item?id=31975507
(Dont turn on sound, i dont know how to make it sound nicer)
The detail slider is a manual thing. You put the render call with 1/2/3 level in the loop. Only the lines with same render level will be displayed. Can be used to see the sorting at different granularity.
Latch: switch to a different tab mid-sort. Switch back to stop the latch.
Metronome: Hit "valley" and run selection sort.
Free Jazz[1]: Hit "shuffle" and run bitonic sort.
Author of the project here. Thank you for your warm words, and a bunch of feedback. I created the project mainly to learn about Svelte and play with algorithms, these running bars fascinate me. I was hoping that this tool would also help understand how sorting algorithms work. I still have a few features planned, such as advanced statistics.
If you have any ideas on how to develop this or want to contribute with me, I would be happy to invite you
I would also like to thank you for the stars on Github, it is really satisfying when someone enjoys the fruit of my work.
I assume you are just changing the frequency instantly or something. It would sound far better to implement polyphony and have a basic short AD envelope that is triggered for each step and allow a tiny overlap at the end
The thing about the stars, though: some of us fear that a utility site for our work, GitHub, is getting enshitified into a social media platform. So for those of us in that camp, the stars system is unwelcome all by itself, and catering to it is the opposite of what we want to encourage.
Your desire for feeling the work is appreciated is definitely reasonable though. I hope how much I like it comes across loud and clear :)
Is there a reason for the dramatic speed-up around delays of 1.8-2ms? On my machine Quick Sort takes 12 seconds at 2ms, about 6 seconds at 1.9ms, and just over 1 second at 1.8ms (with the default 300 items).
Divine sort A sorting algorithm that takes a list and decides that because there is such a low probability that the list randomly occurred in its current permutation (a probability of 1/n!, where n is the number of elements), there must have been a reason for the list's order. Therefore, it should be considered sorted in a way we don't understand, and we do not have any right to sort it to our beliefs, as if it were sorted "as God intended." Also known as Intelligent Design sort.[11]