No video

Tim Sort

  Рет қаралды 220,754

Timo Bingmann

Timo Bingmann

Күн бұрын

Visualization and "audibilization" of the TimSort algorithm.
Sorts a random shuffle of the integers [1,100] using TimSort (standard sorting algorithm in Python, Java SE 7 and on Android). See en.wikipedia.or... for an explanation. The C++ implementation from github.com/gfx/... was used.
After the slow sorting of [1,100], the algorithm is run again faster on [1,1260].
More information on the "Sound of Sorting" at panthema.net/20...

Пікірлер: 148
@Crossark1
@Crossark1 7 жыл бұрын
AND HIS NAME IS JOHN CENA! 0:39
@slowsloth3809
@slowsloth3809 6 жыл бұрын
Crossark1 HOLY SHIIIT Edit : 0:53 Pacman ate a ghost.
@Welowas
@Welowas 6 жыл бұрын
I didn't laugh out loud but this is still fucking hilarious.
@raffimolero64
@raffimolero64 6 жыл бұрын
1:06 the REAL pacman ate a ghost.
@AidenOcelot
@AidenOcelot 6 жыл бұрын
Crossark1 how do I like a comment twice!?
@slavaxkt5997
@slavaxkt5997 5 жыл бұрын
lmao
@AAAAAAAAAA42
@AAAAAAAAAA42 9 жыл бұрын
Thanks Tim
@jeongheonlee4556
@jeongheonlee4556 6 жыл бұрын
A bastard born between merge sort and insertion sort
@kaylamitchell1982
@kaylamitchell1982 6 жыл бұрын
Not the best parts combined, the worst ones.
@RipleySawzen
@RipleySawzen 5 жыл бұрын
@@kaylamitchell1982 Actually it's the best ones
@nsq2487
@nsq2487 5 жыл бұрын
@@RipleySawzen Dude it's so fucking slow. Worst parts, definitely
@RipleySawzen
@RipleySawzen 5 жыл бұрын
@@nsq2487 How can you not even realize this is slowed down so you can actually see it? If it were in real time the entire video would be LITERALLY ONE FRAME. This would still hold true if there were 100 times as many entries to sort.
@nsq2487
@nsq2487 5 жыл бұрын
@@RipleySawzen The way the video is slowed down is by adding a fixed delay after each comparison. Yes the process is dramatically slowed down for us, but it's still representative of the actual time it will take for the sort. What appears slow to us will also be slow in real life.
@ayior
@ayior 5 жыл бұрын
And here I thought the person who uploaded this video came up with a new sorting algorithm and sorta named it after himself
@dlwatib
@dlwatib 9 жыл бұрын
A very good stable hybrid sort for modern machines with plenty of memory. Performs well on all input data [best case O(n), worst case O(n log n)] but uses O(n) extra space.
@Manuel5975p
@Manuel5975p 4 жыл бұрын
It's best case n log n
@nahrafe
@nahrafe 3 жыл бұрын
@@Manuel5975p nah it's O(n), O(n log n) would be original merge sort.
@Manuel5975p
@Manuel5975p 3 жыл бұрын
@@nahrafe hmmm, is the merge step different from the original?
@lucass8119
@lucass8119 3 жыл бұрын
@@Manuel5975p best case is if array is already sorted. Tim sort will divide array based on segments that are all already in order and will then merge them. If it is all in order, no merge will be done, therefore linear time
@domjanabi6006
@domjanabi6006 4 жыл бұрын
1:49 when someone repeats something slowly to me expecting me to understand what they're talking about
@blackapple2938
@blackapple2938 6 жыл бұрын
hi my name's tim sort
@davidegaruti2582
@davidegaruti2582 3 жыл бұрын
My name is sort ... Tim sort
@NoMoreForeignWars
@NoMoreForeignWars 3 жыл бұрын
Tim pool made this.
@raymondhettinger9603
@raymondhettinger9603 10 жыл бұрын
Thank you for the visualization. I have one important request though. Can you publish another video but with a dataset that shows-off the winning feature of Timsort which is taking advantage of partial orderings in the dataset. In other words, Timsort mainly shines with real data and isn't anything special when confronted with pure random numbers.
@frempy4426
@frempy4426 Жыл бұрын
No
@snazzysportstacker
@snazzysportstacker 7 жыл бұрын
i only listen to real music
@FranklyNorman
@FranklyNorman 5 жыл бұрын
Hands down the best video game I’ve ever played.
@Kidboo377StudiosGaming
@Kidboo377StudiosGaming 7 жыл бұрын
This is almost just like the merge sort.
@MADMACHlNE
@MADMACHlNE 6 жыл бұрын
That's because the Tim sort is just a smart merge sort that can tell when it would be more efficient to switch over to an insertion sort.
@TheLujamusic
@TheLujamusic 6 жыл бұрын
Bottom-up mergesort to be exact
@VY_Canis_Majoris
@VY_Canis_Majoris 6 жыл бұрын
There’s no one in your contacts matching ’Tim Sort’.
@dannyundos8927
@dannyundos8927 9 жыл бұрын
I still don't know what "galloping mode" is, though.
@alexjago51
@alexjago51 5 жыл бұрын
You might've learned in the three years since, but it basically just exploits cases like where the smallest value in the A side of a merge is bigger than quite a few values in the B side (or vice versa). So the 'galloping' refers to the search process of where to insert the first A-side value after the B-side run.
@saopy
@saopy 6 жыл бұрын
Thank you Tim, very cool!
@JackLe1127
@JackLe1127 9 жыл бұрын
so correct me if i'm wrong. Tim sort is technically merge sort with the base case of the minimum size of a run. a run will then be sorted using a different sorting algorithm?
@smaybius
@smaybius 2 жыл бұрын
Runs are created using binary insertion sort just like with std::stable_sort. It's also adaptive and can flip reversed groups and detect how sorted groups sre
@ona512
@ona512 6 жыл бұрын
Did I accidentally turn on Everything Is Going To Be Ok
@philipnelson5
@philipnelson5 7 жыл бұрын
Why would you tim sort random data?
@0Namington
@0Namington 7 жыл бұрын
Because it's cool.
@fubarhandle
@fubarhandle 7 жыл бұрын
Came to the comments for this.
@user-ix9lw1te8j
@user-ix9lw1te8j 5 жыл бұрын
its for visualization purposes
@RipleySawzen
@RipleySawzen 5 жыл бұрын
What would you suggest?
@Reza_Alizade
@Reza_Alizade 4 жыл бұрын
Yes Timsort must be shown on data included some sorted ones
@karamboubou8579
@karamboubou8579 6 жыл бұрын
This is basically weave sort/merge + insertion sort
@asafkaya9227
@asafkaya9227 2 жыл бұрын
Thank you. Now I am addicted.
@anastasiadunbar5246
@anastasiadunbar5246 6 жыл бұрын
1:51 Sounds like a crying baby.
@freedom_is_in_your_mind
@freedom_is_in_your_mind Жыл бұрын
Не знаю, как я попал сюда, просто проснулся в 3 часа утра и решил сделать запрос в гугл "аэродинамика коровы"
@orinzyze7625
@orinzyze7625 5 жыл бұрын
shoutouts to all the tims out there
@RonWolfHowl
@RonWolfHowl 5 жыл бұрын
Insertion sort to a certain length, followed by merge sort.
@user-pi8bm3pw1b
@user-pi8bm3pw1b 4 жыл бұрын
looks like a merge but sorting is little different
@sutterismine
@sutterismine 3 жыл бұрын
.sorted() python function behind the scenes!
@Axadn
@Axadn 6 жыл бұрын
so satisfying
@OrhanGHafif
@OrhanGHafif 6 жыл бұрын
Explains better than the paper. (Entry nick uyumu yazıcam ama kim gelecek de görecek asdasdas)
@AzureLazuline
@AzureLazuline 11 жыл бұрын
I was expecting an explosion sound at the end
@skandragon586
@skandragon586 5 жыл бұрын
Ive been watching these sorts and i was wondering how you end up with two copies of some elements in the list? Like at 0:50 there are several of the lower elements being duplicated onto the left side before being removed from the center/right
@ME0WMERE
@ME0WMERE 2 жыл бұрын
It's slowly replacing the list shown with the sorted section of the list in auxiliary memory
@tomergngn
@tomergngn 2 жыл бұрын
it might look the same for the naked eye, but they are slightly different. It uses an algorithm called "Merge Sort" (Time Complexity O(n + m)). It checks which value is lower every time and puts it next on the list. because in this video the values are very similar, the merge sort will run into many close numbers, which in the speed it's moving and in the lack of better eye equipment will look the same to you.
@ME0WMERE
@ME0WMERE 2 жыл бұрын
@@tomergngn at 0:50, where do the middle values go? Exactly. They are being overwritten by values from auxillary memory.
@tomergngn
@tomergngn 2 жыл бұрын
@@ME0WMERE oh you're right, I was wrong. I thought that's what the algorithm did, my bad
@want-diversecontent3887
@want-diversecontent3887 5 жыл бұрын
Tim sort: Insertion sort, merge…sometimes backwards
@solar.mp3
@solar.mp3 6 жыл бұрын
0:35 sounds like a tune
@jercki72
@jercki72 7 жыл бұрын
it's an insertion sort combined with a merge sort
@FirstNameLastName-bq9hs
@FirstNameLastName-bq9hs 7 жыл бұрын
man, i enjoy this video
@user-mf9mk9kt8p
@user-mf9mk9kt8p 6 жыл бұрын
0:28 How the bars disappear and re-appear?
@legoshaakti
@legoshaakti 6 жыл бұрын
It’s writing them to a second array
@Ambipie
@Ambipie 4 жыл бұрын
Like putting pencils into a case
@thaongan3445
@thaongan3445 5 жыл бұрын
Tim sort is the sorting algorithm combine by insertion sort, merge sort or something else?
@argentonath
@argentonath 4 жыл бұрын
Tim sort is a smart hybrid of merge and insertion sort. It takes advantage of already sorted runs that often exist in real world data. If they're too small, it uses insertion sort (which is very fast when applied to small lists) to make bigger runs. Then it merges sorted runs, which is faster than merging unordered lists like traditional merge sort. If you're curious about the details, google "timsort.txt" and you'll find Tim's original description (or look on python's issue tracker for issue 587076, where it is attached)
@eduardo.chaves
@eduardo.chaves 2 жыл бұрын
Timsort vs quicksort, which is best and when to use which?
@WaterCrane
@WaterCrane Жыл бұрын
A better one is Timsort vs. Introsort (although simple quicksort works too). Introsort is best when you want speed. Timsort is best when stability is the priority (elements with the same key value retain their order), but still want speed.
@DriftHyena
@DriftHyena 6 жыл бұрын
This is some poltergeist level sound shit
@microman502
@microman502 5 жыл бұрын
nice job tim
@_lapys
@_lapys 5 жыл бұрын
I've seen this software somewhere... From the Hopson KZbin channel?
@RammusTheArmordillo
@RammusTheArmordillo 7 жыл бұрын
The second part sounds like alien music
@sergeymurtazin1416
@sergeymurtazin1416 6 жыл бұрын
I love you videos!
@RaccoonPower
@RaccoonPower Жыл бұрын
Gnome Sort 2.0 + Merge Sort
@Huffy-dl6mi
@Huffy-dl6mi 6 жыл бұрын
I'm disappointed because it didn't show it's collection of toys and go "heh"
@violetvoxel
@violetvoxel 6 жыл бұрын
Sorting from the Nile.
@ALLCAPS
@ALLCAPS 6 жыл бұрын
looks like merge sort and slow sort combined. lol
@teeth.2162
@teeth.2162 3 жыл бұрын
May be my favourite sort. Until I find another sort that is better.
@MarkAnthonyLaureta
@MarkAnthonyLaureta 6 жыл бұрын
The operation seems expensive af
@amey7064
@amey7064 5 жыл бұрын
When you realize there's a 50ms delay, else...
@user-hj2ft3du9g
@user-hj2ft3du9g 3 жыл бұрын
amazing!
@miso-ge1gz
@miso-ge1gz 4 жыл бұрын
some kind of weird mergesort?
@theblob2937
@theblob2937 3 жыл бұрын
This reminds me of 2048
@tropicbliss1198
@tropicbliss1198 3 жыл бұрын
list.sort()
@BulGoogol
@BulGoogol 10 ай бұрын
That look like merge sort
@boofy1347
@boofy1347 Ай бұрын
real
@ImBowsa
@ImBowsa Жыл бұрын
Tim 👍
@1024det
@1024det 4 жыл бұрын
TIMLIBIADEO! TIMMAH!
@cvItist
@cvItist Жыл бұрын
Faith soundtrack
@DanChou626108
@DanChou626108 9 жыл бұрын
awesome!
@doc736
@doc736 5 жыл бұрын
Think I've found the perfect ringtone for my phone
@brkrab8818
@brkrab8818 11 жыл бұрын
nice clip
@gamesstar-zs5qe
@gamesstar-zs5qe 3 жыл бұрын
Visualization
@mistermoee
@mistermoee 6 жыл бұрын
merge sort 1/8 version
@demensdeum_live
@demensdeum_live 2 жыл бұрын
лютый
@triclamite
@triclamite 3 жыл бұрын
tim
@joeshoesmith
@joeshoesmith 6 жыл бұрын
This is basically merge sort tho
@RipleySawzen
@RipleySawzen 5 жыл бұрын
But faster
@jakerussell135
@jakerussell135 3 жыл бұрын
merge sort but it starts with larger chunks and does an insertion sort for them
@Cpt.C
@Cpt.C Жыл бұрын
why is it so funny?
@dabbingsquidwart2434
@dabbingsquidwart2434 5 жыл бұрын
Man, tim is loud.
@Shmark
@Shmark 2 жыл бұрын
1:57 ᵗⁱᵐ....... *Soooooooooooooooorₜ*
@juliagiacomelli9056
@juliagiacomelli9056 7 жыл бұрын
Could someone try to explain the Timsort algorithm or indicate a site to me? I have to make a research about it, but I haven't found almost any information...
@tttc
@tttc 7 жыл бұрын
Go to its Wikipedia page, that is listed in this video's description, and read through it. Also read the links listed under Further Reading and External Links.
@tttc
@tttc 7 жыл бұрын
No idea what you mean mate.
@jamescaldwell2592
@jamescaldwell2592 6 жыл бұрын
username Why would it ever be an ulterior motive... it's a fuckin sorting algorithm...
@connorconnor2421
@connorconnor2421 5 жыл бұрын
*_hEy TiMoThY!_*
@GumRavil
@GumRavil 2 жыл бұрын
Я залип
@want-diversecontent3887
@want-diversecontent3887 6 жыл бұрын
You're not supposed to use it on random data.
@user-um7zf4le1p
@user-um7zf4le1p Жыл бұрын
0:49
@user-nx4su4sw7h
@user-nx4su4sw7h 2 жыл бұрын
Кросивое
@KakoSchwartz11
@KakoSchwartz11 2 жыл бұрын
Python
@CrazyTankersVN
@CrazyTankersVN 3 жыл бұрын
I am merge sort but cooler...
@Timur_Koniakin
@Timur_Koniakin 2 жыл бұрын
залип
@Tracy_AC
@Tracy_AC 8 жыл бұрын
So is this insertion sort in the beginning just to get the data semi-ordered, and then merge sort?
@danieldelizaur8613
@danieldelizaur8613 8 жыл бұрын
it is a bit more complicated than that. Timsort searches for already sorted subsequences called "runs". If the runs are smaller than a certain value, called "minrun", insertion sort is used to balance the lengths of the runs. then the algorithm uses a modified version of merge sort in order to get the sorted array. Note that sometimes the direction of the merge changes and only a half part of array is being copied to the auxiliary array. There are other things like "galloping mode" that boost the sorting in some cases, but they are complex to explain. That's all I know.
@LittleFarmLife1637
@LittleFarmLife1637 Жыл бұрын
00:00:30 🍭🍭🍭🍭🍭🍭🍭🍓🍓🍓😻😻😻😻😻😻😻😻😻😻😻😻😻🦄🦄🦄🦄🦄🦄🦄🦄🦄😻😻😻😻😻😻😻😻😻😻😻😻😻😻😻😻😻😻😻😻😻
@VoidGravitational
@VoidGravitational 11 ай бұрын
wtf
@supercena163
@supercena163 7 жыл бұрын
卧槽 炫酷狂拽吊炸天
@walclow8247
@walclow8247 Жыл бұрын
that's kinda horrible!
15 Sorting Algorithms in 6 Minutes
5:50
Timo Bingmann
Рет қаралды 24 МЛН
Timsort
17:11
Musicombo
Рет қаралды 10 М.
ROLLING DOWN
00:20
Natan por Aí
Рет қаралды 10 МЛН
Fast and Furious: New Zealand 🚗
00:29
How Ridiculous
Рет қаралды 49 МЛН
Ik Heb Aardbeien Gemaakt Van Kip🍓🐔😋
00:41
Cool Tool SHORTS Netherlands
Рет қаралды 5 МЛН
Сортировка Timsort
7:52
Pavel Yurkin
Рет қаралды 6 М.
The Legend of YouAreAnIdiot.org
18:01
NationSquid
Рет қаралды 10 МЛН
What happens if you connect Windows XP to the Internet in 2024?
20:35
10 FORBIDDEN Sorting Algorithms
9:41
Ardens
Рет қаралды 841 М.
[TAS] Brain Age: Train Your Brain in Minutes a Day!
8:25
Frostbyte
Рет қаралды 587 М.
Gravity Sort (Beadsort)
7:16
Musicombo
Рет қаралды 28 М.
Flex Sort
34:17
⅏The Third Arrival⅏ (TTA)
Рет қаралды 592
Timsort
5:34
Иван Кравчук
Рет қаралды 692
Sorts - Sphere Agitation
7:47
w0rthy
Рет қаралды 607 М.
ROLLING DOWN
00:20
Natan por Aí
Рет қаралды 10 МЛН