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.
It sounds like the audio waveform is simply cutting off rather than polyphonically fading in and out, which causes clicking on basically all the sounds. Especially noticable on the sine wave.
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
(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.
Ok spent way too much time fiddling with the options and testing out different sort algorithms. It’s fun to start with one sort and then halfway through switch to one that is very different and see if it helps or hurts the performance. Almost makes me want to break out the old Algorithms and Data structures book to remind myself of which one to use when you know the data could already be half sorted vs when you know the data is going to be completely random.
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.
Thank you for the suggestion. Well... I really aim to create a more "musical" sound, but I must admit that I lack knowledge in the field of creating a pleasant sound using oscillators, which is necessary here.
I made a similar thing earlier this year at https://www.mathsuniverse.com/sorting that doesn't have music and focuses more on teaching students how different sorting algorithms work and how they compare to each other.
Not necessarily. Initialize the data to "Mountain" or "Valley" and run quicksort, and you get O(n^2) behaviour.
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!) .
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.
reply