r/ProgrammerHumor • • Mar 16 '20

Sort algorithm

65.4k Upvotes

614 comments sorted by

3.8k

u/theeggman84 Mar 16 '20

If she's doing bucket sort at this age, then she's set.

776

u/SharkLaunch Mar 16 '20

But sets are unordered

135

u/Raydan4 Mar 16 '20

Except sometimes if you are using python and you have a set of integers

54

u/thegodzilla25 Mar 16 '20

Aren't python sets also unordered though? I dont understand what you mean.

41

u/Raydan4 Mar 17 '20

Technically yes, but the way that hashing integers works, in standard python, integers are added to sets in order, at least most of the time. Implementations of python like pypy do not have this behavior.

→ More replies (2)
→ More replies (1)

29

u/Epithus Mar 16 '20

Have you seen toddlers? They are the very definition of "unordered".

119

u/[deleted] Mar 16 '20

Franchises are small businesses. They are lying.

→ More replies (6)

8

u/divagob107 Mar 16 '20

Yes, a HashSet is impressive, but does she have a bucket List?

→ More replies (3)

1.5k

u/aayush_aryan Mar 16 '20

That happiness after getting it sorted... Her Programming methods and languages might change, but that happiness will always be there.

375

u/ununium Mar 16 '20

I make the same expression and dance after solving a programming problem. This girl will enjoy CS.

293

u/EnIdiot Mar 16 '20

Yep. No other profession can make you go from idiot to genius in under 60 seconds flat. Unfortunately, the opposite is also true.

43

u/you-are-not-yourself Mar 16 '20

In CS, you spend a lot more time feeling like a dunce than a genius. Once you hit your Eureka moment, then it's on to the next problem. It's humbling.

→ More replies (4)
→ More replies (9)
→ More replies (4)

20

u/jonny_wonny Mar 16 '20

Immediately followed by “now what do I do with my life”

→ More replies (3)

1.5k

u/NimbusHeart Mar 16 '20

The last reaction exactly resembles my reaction when my program runs successfully.

351

u/[deleted] Mar 16 '20

Yesss! It says "Hello World"! Yeeeeessss!

46

u/Ekstdo Mar 16 '20

tbh, if you spend hours trying to glue libraries and languages with all sorts of stuff and frameworks together, a simple thing as "Hello World" might give you a bigger smile, than you'd want to admit.

12

u/Dilka30003 Mar 17 '20

Getting the sample code running was a ride just yesterday.

8

u/FerynaCZ Mar 16 '20

This is what I liked on Visual Studio when launching C# for the first time.

63

u/DoctorStrangeBlood Mar 16 '20

12

u/user__3 Mar 16 '20

You gotta let the office know how proud you are

12

u/vanderZwan Mar 16 '20

Including the last second crash back to the reality of opening the next ticket

15

u/akshayk904 Mar 16 '20

Oh i thought only me and the kids did that...we are not alone

3

u/BAM5 Mar 16 '20

When your sort algo passes the unit test

2

u/Grizknot Mar 16 '20

I just had the reaction two minutes ago when my program that was taking 8 hours to run finished in 5 min. Wife who's also working from home behind me was like what are you so happy about?

hashtables are the elixir of the gods

2

u/Dilka30003 Mar 17 '20

When I don’t think it will work but it actually does.

→ More replies (5)

1.8k

u/aser92 Mar 16 '20

Ah the infamous cute sort.

Heard of it but I've never seen it with my own eyes till today.

259

u/T-T-N Mar 16 '20

Looks like a variant of insertion sort

271

u/elperroborrachotoo Mar 16 '20

An insertion / bogosort hybrid.

All our algorithms lack that victory dance, though.

75

u/maybeSkywalker Mar 16 '20

And are therefore not good enough

37

u/Fear-Surprise-And Mar 16 '20

We need an algorithm that sorts and then shuffles the numbers up again solitaire-win style

13

u/aalapshah12297 Mar 16 '20

Now someone will make a variant of std where every algorithm prints 'Fuck yeah! I did it!' on termination.

→ More replies (2)

3

u/TheElectrozoid Mar 17 '20

it's what happens 9 months after the insertion sort 😏

59

u/stealthcwj Mar 16 '20

I am thinking of the computer sorting my arrays and doing the dance at the end... no wonder there is a lag after sorting...

14

u/Aethermancer Mar 16 '20 edited Apr 14 '26

If you're reading this, the original post got nuked by Redact. I use it to automatically purge my digital footprint from social networks, people search sites and messaging apps.

capable aback spoon soup steep historical snow rock many longing

146

u/Curtmister25 Mar 16 '20

Sort of an algorithm.

42

u/the_horse_gamer Mar 16 '20

it somewhat resembles insertion sort

22

u/HawkinsT Mar 16 '20

It somewhat resembles bogosort.

→ More replies (1)
→ More replies (2)

145

u/DrOverbuild Mar 16 '20

How do I get my program to do that little dance at the end? I’m using python

85

u/[deleted] Mar 16 '20

import cute

38

u/Unlock17A Mar 16 '20

child.Pop()

38

u/ThreeJumpingKittens Mar 16 '20

instructions unclear: blood all over the floor now and I've been arrested by the police. perhaps I'll try again under the debugger

5

u/awakenDeepBlue Mar 16 '20

Pair programming.

87

u/LetReasonRing Mar 16 '20

I had to do a couple Towers of Hanoi puzzles for an ADHD evaluation a few weeks ago, and this video depicts exactly how I felt my evaluator was looking at me (except I'm a near 40 year old man).

25

u/[deleted] Mar 16 '20

I feel like that's not a fair evaluation considering there's an algorithm that you can learn to solve any Tower of Hanoi problem just by counting in binary. So what is you're just really good at those puzzles like me?

→ More replies (9)

379

u/[deleted] Mar 16 '20

My cousin would probably just try putting them on his head and drooling, this seems to be a higher level language specimen

284

u/vancity- Mar 16 '20

I can recommend the book So Your Child Is A PHP Programmer

92

u/[deleted] Mar 16 '20

Chapter 1: How to Tell the Grandparents

46

u/HSX610 Mar 16 '20

Chapter 2: How to Cope with Child Loss

→ More replies (4)

3

u/Adamulos Mar 16 '20

Bogosort is designed to never dissapoint

→ More replies (2)

137

u/ChaosOS Mar 16 '20

Why aren't the cups in roygbiv order?

150

u/RainbowDarter Mar 16 '20

The table needs to be reindexed.

28

u/jasmin3dragon Mar 16 '20

Or it’s a hash index. So the order of the buckets doesn’t matter. You just have to search for exactly one color only, then you can find it super quick.

6

u/hate_picking_names Mar 16 '20

We have two sets of similar cups at home (both of our sets are from the same place, but they are different than the ones in the video) and the colors don't match between the sets. If I had to guess, they might just make all sizes (or several sizes) with a bunch of colors and you get what you get.

→ More replies (10)

71

u/firefox57endofaddons Mar 16 '20

the most adorable sorting algorithm i've ever seen :)

also so happy once she was done :)

15

u/Blizz119 Mar 16 '20

That dance is better than winning solitaire.

4

u/brycex Mar 16 '20

Awwgorithm?

2

u/npequalsn Mar 16 '20

runtime expectation:
O=n^(n-c)
(n)umber of cups
(c)ookies at stake

27

u/[deleted] Mar 16 '20

O(adorable)

22

u/ribo Mar 16 '20

Had these cups for my kids too. In all seriousness it really is amazing watching them master it and evolve their spatial reasoning to sort them.

21

u/[deleted] Mar 16 '20

Sort should always have a celebration outro.

37

u/PaperCrane828 Mar 16 '20

Wholesome :) lol I thought for a second she threw up two middle fingers at the end

16

u/bowmans1993 Mar 16 '20

This video is so much better with sound

7

u/Ionlypost1ce Mar 16 '20

Well can you send that please. As usual moron OP didn’t provide. I hate redditors.

14

u/ollomulder Mar 16 '20

It's called toddlersort and represents the result of almost everyone that tries to implement a sorting algorithm by themselves.

11

u/AssG0blin69 Mar 16 '20

Imagine hugging your algorithm whenever it completes a task

3

u/KingJellyfishII Mar 16 '20

That's literally neural networks though (well not really but you get the point)

10

u/ThaiJohnnyDepp Mar 16 '20

The air punch celebration gets me every time

8

u/KovaAtWork Mar 16 '20

Toddler Sort?

8

u/measly92 Mar 16 '20

How did she manage to implement bucket sort in O(n^2)?

22

u/[deleted] Mar 16 '20

That algorithm is cute but no so efficient.

7

u/TheCheesy Mar 17 '20

The best part about a good sorting algorithm is the hugs after.

10

u/[deleted] Mar 16 '20

This is the cutest sort I have seen...

5

u/akshayk904 Mar 16 '20

Its known as Baby Sort

5

u/[deleted] Mar 16 '20

She's so fucking cute. Heart melted a bit.

5

u/Mr_Arthtato Mar 16 '20

Ah, babysort. Classic

5

u/starboigg Mar 16 '20

That's a bucket sort algorithm right there.

5

u/Err0r_Dog Mar 16 '20

That’s what I needed to see at the end of my 12h shift. You’re a good wo/man, thank you.

5

u/ceriodamus Mar 17 '20

My sort algorithms also does a victory dance when done.

9

u/ShichitenHakki Mar 16 '20

Wholesomely inefficient.

4

u/jmack2424 Mar 16 '20

Dammit. Faster than my first sort algorithm.

7

u/0IsNotANaturalNumber Mar 16 '20

Is this how kids learn the difference between efficiency and effectiveness these days?

→ More replies (1)

3

u/saiborg7 Mar 16 '20

Insertion Sort?

3

u/[deleted] Mar 16 '20

she's definitely more performant than my home brewed sort functions

3

u/Portugal_Stronk Mar 16 '20

How do I make my algorithm dance after it finishes?

3

u/TheN473 Mar 16 '20

Still quicker than my usual code.

3

u/DarkwingDuckHunt Mar 16 '20

I do a dance everytime my shit works to

3

u/jburtson Mar 16 '20

I didn’t look at the sub and was thinking, this is like a sorting algorithm

3

u/mr__scripter Mar 16 '20

monkey can do it faster :)

3

u/Morpheyz Mar 16 '20

Her reaction is definitely the same reaction every programmer has when they implement their first sorting algorithm

3

u/[deleted] Mar 16 '20

Why did I just watch a child sort colored buckets for 45 seconds and then get so happy when she succeeded? Is this what's it like to be a parent?

→ More replies (2)

3

u/dangil Mar 16 '20

cute, but inefficient... fire her

3

u/wilcomylove Mar 16 '20

Bucket sort of course

3

u/ajss182 Mar 16 '20

And my mom still can't understand plugging in an HDMI cable.

3

u/[deleted] Mar 16 '20

toddlerSort()

3

u/ToranMallow Mar 16 '20

Okay, that was freaking adorable, and I don't even like kids.

3

u/mr_smith24 Mar 16 '20

That little dance of victory is so cute

3

u/[deleted] Mar 17 '20

Little known fact: ksort accepts a second arg (bool) and if set to true does a dance on completion.

3

u/audra_williams Mar 17 '20

My partner just showed me this video! I am not a programmer, but I used to be an ASL interpreter. I'm pretty sure at the end the little girl gleefully signs something like "You tried to do the same thing but can't!" And then "Yesss."

Aaaa my heart. This precious child!! <3

3

u/tuxmanexe Mar 17 '20

O(n!n! )

3

u/Xenderman Mar 17 '20

This is legit the cutest thing I've ever seen

5

u/Lasdary Mar 16 '20

Maybe I'm just reading too much into it but it's fascinating how the learning process works on a toddler like this.

4

u/666White_Wolf666 Mar 16 '20

Task done.

Now it's time to terminate the program

2

u/achilliesFriend Mar 16 '20

Is this exponential sort?

2

u/[deleted] Mar 16 '20

I want my algorithms to dance like her

2

u/[deleted] Mar 16 '20

When you believe standard sorting algorithms are shit and you write your own one.

2

u/quickmana Mar 16 '20

Future Google employee!

2

u/fel_bra_sil Mar 16 '20

well that's the sweetest algorithm I've seen so far

2

u/GoRapsOVO Mar 16 '20

I want kids all of a sudden

2

u/CodyByTheSea Mar 16 '20

That will run in O(N2 ), can you optimize it

2

u/[deleted] Mar 16 '20

Best what a smartie.

→ More replies (1)

2

u/[deleted] Mar 16 '20

She’s gonna be a programmer someday. Just you wait.

2

u/Bit5keptical Mar 16 '20

I wish my sorting algorithms celebrated when they're done.

2

u/[deleted] Mar 16 '20

runs faster than most of my code

2

u/Simres Mar 16 '20

This is so wholesome

2

u/RaymondMasseyXbox Mar 16 '20

Dang did sort algorithms improve since I went to college?

→ More replies (1)

2

u/[deleted] Mar 16 '20

This child is already smarter than some grown ass adults.

2

u/[deleted] Mar 16 '20

I usually have that same reaction when my code works

2

u/arnathor Mar 16 '20

She’s a real life Boo from Monsters Inc.

2

u/portabuddy2 Mar 16 '20

My shippers could not do this with three fucking boxes. HIRED!

2

u/Allanon32 Mar 16 '20

Hell yea, sitting at working watching this little girl figure that out is the highlight of my day.

2

u/luckor Mar 16 '20

The famous toddler sort.

2

u/[deleted] Mar 16 '20

holy shit she is adorable

2

u/[deleted] Mar 16 '20

my sorting algorithms never were this happy after finishing sorting

2

u/I2ed3ye Mar 16 '20

After she finished sorting the stack and started celebrating, I swear I heard "Knuck If You Buck" by Crime Mob blasting

2

u/bluedogmilano Mar 16 '20

the same efficiency of MongoDB $sort

2

u/r1chard3 Mar 16 '20

Now that’s a victory dance.

2

u/obvlong Mar 16 '20

Baaaaby sort! Do do... Doo. Do do dooo

2

u/Badger_boy_198 Mar 16 '20

I hope programmers dance like that after doing good too

2

u/[deleted] Mar 16 '20

Tiny baby AI machine learning training. We're doomed

2

u/Hyper-naut Mar 16 '20

What a cutie ! With great patience too...

2

u/Honokeman Mar 16 '20

Ah yes, toddler sort

2

u/Gojogab Mar 16 '20

She's a genius.

2

u/fzammetti Mar 16 '20

Impressive.

Can she pseudo-code that on a whiteboard?

2

u/GammaGames Mar 16 '20

Baby Sort

2

u/brand0n Mar 16 '20

why no sound...that was cute

2

u/Dwighthaul Mar 16 '20

That's a big O(n²)

2

u/[deleted] Mar 17 '20

O(n^2)

2

u/[deleted] Mar 17 '20

At least she didn't go with BogoSort. I'd hire her.

2

u/evil_burrito Mar 17 '20

I'm going to write a new sort algorithm that includes, "try to force it".

2

u/CrypticGuru Mar 17 '20

I feel like my computer does a similar dance after it finishes a rather complex sort 🤣

2

u/[deleted] Mar 17 '20

Actual footage of me attempting a leetcode problem.

2

u/[deleted] Mar 17 '20

I felt happy for her when she finally got it.

2

u/[deleted] Mar 17 '20 edited Mar 17 '20

Out of curiosity, what would this big O be?

2

u/droxius Mar 17 '20

These cups are my favorite toy that my 1-yr-old has. This video is part of the appeal, but they also stack like a pyramid if the cups are mouth down, or like an inverted pyramid if the cups are mouth up. Plus there's this whole phase where a kid first discovers they can put small stuff inside them and that's fun to watch. There's like 20 different ways to play with them and yet the set is completely self contained. Understated genius and I love it.

2

u/alexeypkv Mar 17 '20

The less-known "child sort"

2

u/boraras Mar 17 '20

O(mg I finished it!)

2

u/spikku Mar 17 '20

cutesort

2

u/gibmelson Mar 30 '20

AdorableSort

2

u/[deleted] Jun 19 '20

insertion sort with bogosort mixed in

3

u/[deleted] Mar 16 '20

Wholesome

2

u/[deleted] Mar 16 '20

lmao machine learning

2

u/Solotaire Mar 16 '20

Still faster than Heapsort

2

u/Janephox Mar 16 '20

She is so patient 😄 trying every combination without angering when it doesn't fit. How cute ♥️

2

u/raxci Mar 16 '20

Am I the only one that did a little fist pump when she finally got it

2

u/djShmooShmoo Mar 16 '20

2

u/RepostSleuthBot Mar 16 '20

Sorry, I don't support this post type (video) right now. Feel free to check back in the future!

2

u/johnnyfiveundead Mar 16 '20

No, no, no, NO! Sort them like I sort pots and pans. Pile them up in the cabinet and then wedge the lids at an angle so it all doesn’t fall out every time you open the door. My way is so simple and my wife loves it, right honey?

Mi amor? Where are you going? Hey, we’re supposed to be social distanc- Damn.

→ More replies (1)

2

u/JackBlack76 Mar 16 '20

5

u/RepostSleuthBot Mar 16 '20

Sorry, I don't support this post type (video) right now. Feel free to check back in the future!

1

u/Boiethios Mar 16 '20

Not sure about the complexity. O(n²)?

1

u/Ignifazius Mar 16 '20

Toddlersort? Can we have a complexity here?

1

u/[deleted] Mar 16 '20

That’s how hype I get when my sorting algo works too

1

u/coldnebo Mar 16 '20

heuristic

1

u/[deleted] Mar 16 '20

Neural network is being trained for the sorting task. Give it some time.

1

u/senaya Mar 16 '20

Me after corrrectly placing that one missing </div> somewhere in the html document.

1

u/[deleted] Mar 16 '20

Merge sort

1

u/TheSilentCheese Mar 16 '20

Need to add this success dance to my coding workflow.

1

u/julmonn Mar 16 '20

I'll show this to students next week. Aweosme haha

1

u/[deleted] Mar 16 '20

Anybody else expecting her to say (not literally) "fuck it" and throw the cups across the room? Perhaps checking nestoverflow.com afterwards.

1

u/jib_reddit Mar 16 '20

Looks about as efficient as all the sort algorithms I have ever written.

1

u/SkyNet03 Mar 16 '20

The dear old Bubble sort never fails

1

u/byssain Mar 16 '20

did she just whip

1

u/Maskdask Mar 16 '20

Toddlersort

1

u/voicesinmyhand Mar 16 '20

0:28 This is where most of my sorting code initial attempts escape whatever it is in and begin gobbling the boot sector of the local hard disk.

1

u/jeffsterlive Mar 16 '20

Is this the girl from wreck it Ralph? Adorable.

1

u/[deleted] Mar 16 '20

isn't that the kid from Wreck it Ralph?

1

u/[deleted] Mar 16 '20

So adorable.

1

u/AlexanderYip Mar 16 '20

She's pretty good at buckets but let's she how she handles Professor Layton.

1

u/cornplantation Mar 16 '20

Her victory dance is so cute!

1

u/humblepotatopeeler Mar 16 '20

so EFFING cUTE!

my heart is melting

1

u/a-bser Mar 16 '20

I'm so happy she stuck with it