50+ Sorts, Visualized - Already Sorted Inputs
ฝัง
- เผยแพร่เมื่อ 28 ก.ย. 2024
- Visit our community Discord: / discord
This bar graph visualization features 54 different sorting algorithms sorting inputs that were already in order.
*NOTE: Some algorithms with pathological inputs are skipped partway in this video to save time.
Check out the NEW home for ArrayV here: github.com/gam...
Join our community Discord! discord.com/invite/2xGkKC2
I accept the offer but no
I'd much rather be taught
Me: how to sort sorted input?
Heap sorts: yes
and Wikisort + Grailsort
Merge, bitonic and quick sorts: Yes
Radix sorts:yes
funny how some of them don't know what to do with an already sorted input
I can almost imagine the algorithms swearing at you, "F#%@ YOU IT WAS ALREADY SORTED"
The Heap Sorts(except Smooth Sort) would just slink away, embarrassed after realizing they messed up the list just to put it back the way it was in the first place.
8:46 looks like Batcher''s Bitonic Sort never disappoints
cuz IT IS Batchers bitonicc
Oh
Gnome, talking to already sorted thing:
You’ve been gnomed!
9/10 Radix not earrape enough
Bogo sort is most effective in already sorted Inputs
I think thats cuz it checks if it’s right and if not it shuffles
it cant be fastest bc gnome sorts on already sorted array
but wait bogosort is less than a thousand of a milisecond (in real time)
Technically, Gnome Sort, Insertion Sort, and Bubble Sort(that checks if it's sorted) are all just as good.
All heap sorts:
“Fuck it, might as well just do what we always do!”
So, you're telling me some of these sorting algorithms take milliseconds to complete, but you slow them down immensely for our pleasure?
Yup. Computers are that fast.
@@Musicombo yay
Not time sort
the one dislike was heap sort
Ah yes, thank you weave merge sort
One question - Why isn't Pancake listed under "Impractical"?
Pancake Sort isn't aiming to be fast or slow. It's actually meant to solve a mathematical question.
en.m.wikipedia.org/wiki/Pancake_sorting?wprov=sfla1
Cuz its already sorted
pancake sort what r u doing
its best
sorts be like
what
is it sorted
wait really?
can't be let me check 19384 more times
ye lmao xd
What the hell is Stable Quicksort doing lol
You know how Quicksort has a very bad worst-case complexity? That's what's happening there.
@@Musicombo Well i didn't know a solved state is one of them.
@@Musicombo I had no idea that the worst case for stable quick sort was an already sorted input. That's kinda crazy, actually.
But doesn’t Bubblesort detect when an array is already sorted?
I thought so, too. Bubble Sort usually can check for an already sorted input before even beginning.
Udiprod knows
It's not an inherent feature of the algorithm. You have to do extra coding to add that in.
why does base 16 rasix sort always take that long, is it even practical?
Not really. The reason it takes so long is because of all the operations it has to do.
@@Musicombo I still don't understand. Why does it need so many operations compared to other radix sort methods? Or is it all the in place shifting that takes so long?
@@minemon6804 It's all the in-place shifting that takes up its runtime.
@@Musicombo so when you want to place something in position 0 then you need to shift up 2047 elements by one?
@@yxcvbnmmnbvcxy544 Basically.
Should've uploaded this on April Fools.
Anyone else hear those musical notes around 12:35 ?
Its a Windows notification
perhaps a notification in some opened app at the time of recording
Based Gnome Sort
Me, watching the Flash Sort at 7:43 scan the already-sorted array and make 1 swap: YOU WHAT
HOW
When slow sort can hardly sort something already sorted
ok, HOW did bogosort not screw things up like Heapsort or what?
it checks if it's good first, then if it isn't, randomly shuffles
since its first action was a check, it was immediate
I forgot to say Pancake Sort.. It's slow too.
6:56
Giygas is Wounded B-Side
Silly sort... now with 100% more silly
me: ok its sorted you dont have to do anything right
silly sort: *lets compare*
20:00
572566806 times, as always.
Estimated real time: phew, that was quick
Heapsort brain *cat vibin*
6:27
Grail sort be like boing boing boing boing
Bubble sort does not take 661K comparisons. Only 2047. Your implementation is wrong.
Make them smarter they don't know what to do
WikiSort: (Looks around and found nobody) I'm gonna mess this thing up.
(Someone comes up)
WikiSort: (Put it back to normal and pretend nothing happened)
timestamp??
Idk
13:48
Heapsort: ok first we reverse it.
LMAO
the only type of sorting where bogo sort gets to be the ultimate best
Min heap sort:
F l i p.
Why does it still "shuffle" after each sort?
Its it just there by default?
Yep
Algorithms: "Just to be sure it's ACTUALLY sorted, we decided to do it again."
lmao ye
Sorting algorithms with worst-case time complexities of O(n) on already sorted datasets: Pff, this is easy.
Other sorting algorithms (O(n log n), O(n^2), and worse): WHAT HAVE YOU DONE TO ME?!
Gnome sort: Yep
Insertion: Yep
Comb sort: It's just... not... quite... *smooth enough*
Stable quick sort: ????????????
gnome sort has finally made its redemption.
"Weak heap sort"
**is faster than all the other heap sorts**
But it uses additional memory unlike others.
@@RedstoneNguyen ok
So glad I'm not the only one who realized that
Strong heap sort
Insertion sort:
I was made to be lazy
the gnome and smooth sort seems the quickiest in this case
Well, Insertion also
finally after all this time bogosort gets respect
Beautiful
The bubble sort could easily optimize for the sorted case. Weird that it doesn't. Also odd that Quicksort is doing so well.
Gnome does nothing
M
M
Radix Went In Reverse For A Bit
Why are you watching this? Like really?
Noooooooooooooooooooooooooooo
Shell sort brain aaaaaaaaaaaaaaaaaaaaaaaahyug
"shuffling"
Dude you literally forgot to shuffle.
Huh?
@@Musicombo •
**sigh** nvm...
@@kagechu2005BISVG ...Oh, oh my god. Can't believe I didn't get this joke until now. Oops...
bogo sort!
bogo sort!
Gnome Sort is not to fast, because i think Musicombo forgot to 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024 and 2048. QuickSort LeftLeft/Pointers are slow too.
I don't understand what you mean here...
binary search?
Time sort
How long will this take
Time sort: yes
Me:
Time sort: 800 seconds
timestamp?
Its a bit late for april fools
Who else thought grailsort would go on forever