10 Sorting Algorithms Visualized
HTML-код
- Опубликовано: 8 сен 2024
- GENERAL INFO:
This is a showcase of the program made in the video here: • Coding a Simple Sort A...
Source code available down below, but bare in mind it was my first time using Java Swing and so it is not great.
There is a much better visualizer which can be found here: • 15 Sorting Algorithms ...
EXPLANATION:
There are 256 bars. Each bar has a height depending on the value of an integer array. For example, the bar on the far left has a height of the value of "array[0]" and the far right bar has the value of "array[255]".
As the sort algorithm changes the array, the bars change height accordingly.
Green bars are those most recently changed. They immediately go into a red bar, which gradually fades back to the default white colour.
The sounds being played were made using Java's built in MIDI Channels and Synthesizer. A note is played each time a change to the array is made. The higher the pitch, the higher the value that was changed.
=========
DOWNLOAD: github.com/Hop...
SOURCE CODE: github.com/Hop...
=========
RESOURCES:
=========
MUSIC USED:
Ken Silverman - NEATSONG.kdm
=========================================
LINKS:
GitHub: github.com/Hop...
Discord Server: / discord
Support me on Patreon: / hopson
Follow me on Twitter: / hopson1997
0:02 Bubble sort
0:46 Selection sort
1:22 Cycle sort
1:59 Stooge sort
2:28 Quick sort
3:09 Pancake sort
3:56 Merge sort
4:43 Insertion sort
5:19 Heap sort
6:02 Gnome sort
Which one is fastest?
@@KivySchool Quick sort is the simplest, and nearly the fastest, obviously.
Quick sort just *begs* to be multi-threaded.
Sum Gehnyooiss is this a meme?!
*MULTITHREAD ME*
so does merge sort
Sum Gehnyooiss
merge and radix sorts like
CodeBullet gave you a shoutout.. It might be handy to come back! We'll appreciate it so much! :D
Selection Sort and Cycle Sort have the best music imo
I thought pancake did
I liked the Merge Sort more than others :)
it all depends on the taste, though
Selection Sort's beginning is really good.
MERGESORT
MERGESORT
Oh no! You forgot Bogo Sort! HOW COULD YOU?!
4x speed ontop because this took longer than the expected lifespan of the universe!
KeepDrive Plays
it does bogosort, that's because each "shuffle" is actually 1 bogosort cycle
2:27: my music teacher
3:10:me
It's funny how far superior some of the algorithms are to others. It would be nice to have a quick run up at the end to show just how much the sorting time differences are with the same delay.
It also depends on what sort of data you are sorting. You should always pick the sorting algorithm with respect to your knowledge of your data.
Some data is pre-sorted, hence that insertion sort would work best.
SharpOB
tim sort or any kind of block optimized merge sort would fare quite well too
Definitely need a part 2! The Radix LSD sort is definitely the most interesting with sound, it would have been fantastic with the piano! Also, you should look into the Gravity sort. It would sound awesome too!
Love how the merge sort works.
No bogo sort? :(
ikr
24 hour video
that depends on his luck and how many values are there in the array
By far, the best sounding sorting visualizer I’ve come across.
The code also compiled without a hitch, and runs well on my Mac... I wasn’t able to get Timo’s code running on it at all: I’m not very good at compiling, and he’s not touched the “sound of sorting” package for years.
Cheers!
Actually RadixSort would have been interesting too, maybe there will be a part 2 :D
0:02 Bubble Sort: 14528 steps (2ms per step, 29.056 sec)
0:46 Selection Sort: 255 steps (120ms per step, 30.6 sec)
1:22 Cycle Sort: 254 steps (125ms per step, 31.75 sec)
1:59 Stooge Sort: 16263 steps (5ms per step, 81.315 sec)
2:28 Quick Sort: 1217 steps (30ms per step, 36.51 sec)
3:09 Pancake Sort: 24099 steps (1ms per step, 24.099 sec)
3:56 Merge Sort: 2048 steps (20ms per step, 40.96 sec)
4:43 Insertion Sort: 17364 steps (1ms per step, 17.364 sec)
5:19 Heap Sort: 1840 steps (20ms per step, 36.8 sec)
6:02 Gnome Sort: 15979 steps (2ms per step, 31.958 sec)
Be warned that this is NOT a good video for determining the speed of the different algorithms. Memory usage and difference in cost between compares and swaps are more important. Sometimes you want to sort something which has a very high compare cost to it, while at other times memory is the bottleneck etc.
I feel like the notes follow a major scale
You have a good ear! They are all major :)
I wish I knew music as good as you :( the only thing I got that this was piano :(
Although the numbers can be very random indeed, so I could just as easily be dorian, phrygian, lydian, mixolydian, aeolian (minor) or locrian. Random notes makes it hard to pin down a tonal centre.
@@Hopsonn :0
Bubble sort may be awfully inefficient but I'll never stop loving it
Thanks! I acknowledge another version of this in the video description :)
I love the Merge Sort, it looks awesome :D
I was looking through your old videos and found a project that really interests me, the Empire game. I downloaded it and love playing it over and over, and there are still so many places to go with it. An idea I had would be a "capitals" system, where the place that the colony spawns at would be a capital city and it being taken by another colony could deplete the original colony's strength. I don't know how popular it is with other people, and I know that the Empire video is like a year old, but I for one would love a part three.
Selection sort sounds the best :)
its very satisfying to look at.
I came because I loved your work with making Minecraft in a week challenge. Great video!!
I miss your videos man :(
My A Level comp sci teacher showed us this while learning different sorting algorithms in python. I was so happy.
Stresses me out but it’s damn cool
The best O(n²) ones I've seen elsewhere but not here are cocktail shaker (bubble in both directions at once) and double selection (move both max and min elements each pass).
miss ur vids man :(
Great! Any "best" algorithm you would reccomend for sorting an array of doubles?
Thanks!
Selecting the optimal sorting algorithm should be based on how the data is accessed/used as opposed to what the array stores. For example, if you are going to need a constantly sorted array and will be inserting frequently, then insertion sort is the best bet; whereas if the data is usually unsorted then quick sort or merge sort are a good choice.
Snek sort
hell ye
nice good vid
Informative and interesting. Thanks.
please radix(lsd) sort, it's simple yet very interesting and also one of the fastest when it comes to gigantic arrays
What resources did you use to explore opengl and sfml?
This is so satisfying
Bubble sort sounds like some Hans Zimmer music
Nice
I like how bubble sort is so shitty it is far behind with 15 times less delay and far less blocks than quicksort
Great video!
Do you plan on coming back? I just discovered your Channel and i found it amazing. (Sorry if late)
This is basically a remake of sound of sorting, but with nicer sounds
Yeah it is, I have linked to that in the description :)
It looked cool so I wanted learn the sorting algorithms and try make my own version of it
I like where it uses midi instead of beeps.
will you ever make another video??
Hi Hopson,
I'm sorry if I'm off topic, but about sfml setting up CodeBlocks I have and answer, How do I export an sfml project to another pc?
thanks.
if you listen closely, you can hear every midi that exists (and will exist) in this video
Hello, you should make a turn base game similar to Civilization that would be cool
Will you make another series about Minecraft in c++?
@Maxi Minecraft in python in scratch
@Maxi I don't know at all but Minecraft Bedrock edition is on c++
Can you make things with compute shaders?
Gnome sort? what about gnelf sort?
Best Channel
I hate how no one uses a binary search with insertion sort... I suppose it's only ever used as a bad example of list sorting but still, an obvious improvement.
binary insertion sort is used in Timsort
Some dude just sent this in the League chat, can't wait to feed
Wow cool!
I tried doing these in python with bubble sort. The algorithm was very easy, but I have no idea how to visualize it. Anyone can help me?
Hi, i really want to get into coding and game development. Has nyone got any tips to get better?
2:27 what the HECK? that is NOT the quicksort. Common implementation goes from both ends.
Whoopsie poopsie
whee are youuu
hrrrrrrrrrrrrrrre
@@Hopsonn Good to know youre still with us!
What resources to learn java do you recommend?
Pancake sort be like: YEEEEEEEEEEET
How does the heap sort work?
counting sort not in the list couse its a Hack in sorting very op
Aww man you left out the radixes
Can you make mario 64 in c++?
can u make c++ tutorials. I think it will be great.
Can you do a tutorial on OpenGL/C++?
Just started the video, damn I hope theres bogo sort in this
Oh he gone
Not gone, just busy :(
Hopson Oh he busy*
Selection sort huhuhu
big oof notation are you even alive
yeet
yyyyyyeeeeeeeeEEEEEEEEESSSSSSSSSSSSSSSSSSSSSSSS!!!!!!!!
I suggest you make a game and post it online, even update it.
Please, make random game in java
3:09 Jesus Christ calm down.
why suddenly use Swing ?
As I said in my last video, it is because I have to use it for uni so i want to practice using it lol
well, I haven't been following you a lot, so...welp, I didn't know.
Too bad they didn't choose JavaFX
why does it sound so tinny like you played it on a speaker and recorded it with a mic
Honestly, no idea :(
Do not watch this while your high
Why did RUclips unsubscribe me from you
MAH EEERZ
F
Code hex game in C
Can you make fortnite in one week?
Would take 2 mins Keepo
Bro make big chungus pls😂😂😂
... What?
You have my last name as your yt.
It is also my last name lol
Oh lol xX
[unfunny comment]
Your username and picture are perfect.
[unfunny reply]
[someone who doesn't get the comment and just begs to be wooshed]
is c++ minecraft not a thing anymore? :(
Russian sub please
DON'T PUT DELAYS, it makes it look like the sorting algorithms are worse!
I mean without delays, all them happen instantly lol
Even with same delay, bubble sort etc would take several minutes while merge sort would take like 2s
alright, but some of them, are EXTREME delays.
@@grimtin10 for good reason lol
alright then
lol you are misguiding those who don't know programming XDD (jk
No radix sort lol noob
Record more minecraft and became rich