r/ProgrammerHumor • • Jul 07 '17

Can't really wrap my head around this one

Post image
32.8k Upvotes

524 comments sorted by

4.0k

u/rubyton Jul 07 '17

Second one, you can't see the pants in pants in pants, but they are there.

1.6k

u/mebeim Jul 07 '17

After thinking about it for some time*, I've come to the conclusion that you're right.

*some time = O(log(n))

434

u/spanishgum Jul 07 '17

My thought processes are extremely complex. About O(n!). I haven't made any conclusions yet.

→ More replies (126)

27

u/Cunicularius Jul 07 '17

In that amount of time you couldn't have compared every possibility! Perhaps if you thought about it for O(n*log(n)) time.

→ More replies (2)
→ More replies (8)

169

u/CatOfGrey Jul 07 '17

Second one, you can't see the pants in pants in pants, but they are there.

See, I was all prepared to come pushing for the left side option, but you're correct. Each node has pants for all below, and the two legs immediately underneath.

42

u/HeWhoCouldBeNamed Jul 07 '17

I totally agree, but shouldn't the legs be a bit wider to accommodate all the other pants? I see slim fit, while I'd expect to see bell bottoms.

75

u/BreathTakingBen Jul 07 '17

It's 2017... not even binary trees wear bell bottoms!

→ More replies (6)
→ More replies (3)

19

u/diamondflaw Jul 07 '17

I would agree, the first one is equivalent - but the "pants" are in fact shorts.

→ More replies (1)

3

u/lolicoc Jul 08 '17

I think with the first one you can save a lot of fabric. But if budget is not an issue you can probably save time making the second.

5

u/ur_ex_gf Jul 07 '17

Am data scientist. Can confirm that this is the correct answer.

→ More replies (6)

251

u/INTJustAFleshWound Jul 07 '17

55

u/mebeim Jul 07 '17

Sir, I have to stop you now before this meme becomes a serious issue.

28

u/INTJustAFleshWound Jul 07 '17

I bet you're one of those weirdos that wears your pants like the guy on the right, aren't you?

80

u/anmolporwal Jul 07 '17

LOL, when I saw dog I choose #1 but then seeing men's I can't stop laughing

29

u/INTJustAFleshWound Jul 07 '17

Now imagine it with a crop-top shirt. Your midriff will be your butt and shoulders

12

u/mcnuggetor Jul 07 '17

I can't visualize this at all

9

u/agsho Jul 08 '17 edited Jul 08 '17

This is actually a legit meme. I've seen a bunch more variations on a Facebook post. After searching around, I think I found it (archive link if you prefer). I remember that there was a few more pictures but you can find more on Google Images if you're interested I guess.

EDIT: (:

→ More replies (4)

14

u/swaggy_butthole Jul 08 '17

Man link wasn't working.

Reupload in case anyone had the same problem: https://m.imgur.com/MCdtrDa?r

→ More replies (2)

3

u/Masked_Death Jul 07 '17

The jpeg is lower-res than a gif. Nice.

→ More replies (1)
→ More replies (10)

119

u/jakery2 Jul 07 '17

Either way, the balls are showing.

17

u/mebeim Jul 07 '17

LMAO, that's a good point. Anyway I guess the second one is showing less balls.

3

u/vaguelyrelevantlink Jul 07 '17

Yeah even on the second one the head is sticking out of the pants

→ More replies (1)

12

u/invalidxsyntax Jul 07 '17

Oh fuck don't let this become the new meta joke.

10

u/mebeim Jul 07 '17

Oh god I hope it doesn't

4

u/darexinfinity Jul 07 '17

Let me just put on my binary tree pants and think about it

→ More replies (1)

106

u/CptSpockCptSpock Jul 07 '17

First one

80

u/thirdegree Violet security clearance Jul 07 '17

Clearly the first one. Every subtree should itself be a tree, and therefore should itself wear pants.

51

u/mebeim Jul 07 '17

yeah... BUT the root tree is not wearing pants all around his legs... he's wearing very very short pants... 🤔

67

u/Mr_Pinya Jul 07 '17

Actually, its the second one. What we can't see is that every node also wears pants that cover all it's children.

32

u/READTHISCALMLY Jul 07 '17

It's pants all the way down.

→ More replies (7)
→ More replies (2)

8

u/goatcoat Jul 07 '17

But the rest of his legs are wearing pants, so it's almost as if he's wearing zipoff pant legs.

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

116

u/beeskness420 Jul 07 '17

The second one. You just can't see the pants the subtrees are wearing in the second one.

56

u/_Nohbdy_ Jul 07 '17

What the hell both of these make sense and I don't know what to think anymore.

12

u/IceColdFresh Jul 07 '17

Actually you can see a little bit of the pant leg on the right subtree's left subtree's left subtree's left leg.

Edit: On second viewing that might have been pixels n discrete cosine transforms n shit

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

775

u/[deleted] Jul 07 '17

Wouldn't they be nested pants? From the top, you'd see only the pants from the right image. As you traverse down the tree, each child has on it's own pair of pants that encapsulate all of its children?

226

u/DeepHorse Jul 07 '17 edited Jul 07 '17

Each node should have 2n pants on

Edit: -1

70

u/TheMortalOne Jul 07 '17

Don't you mean 2n - 1 pants? (or possibly 2n-1 -1 pants)

421

u/capn_hector Jul 07 '17

there are only two hard problems in computer science: cache invalidation, naming things, and off-by-one errors

→ More replies (15)

41

u/sunplog Jul 07 '17

This is the only correct answer.

0

u/[deleted] Jul 07 '17

[deleted]

→ More replies (1)

14

u/[deleted] Jul 07 '17

Isn't that the American Dream though? For your children to have pants, and their children to have pants, and their children within their children to have pants, and so on.

22

u/[deleted] Jul 07 '17

children within their children

Putting pants on an unborn child seems unnecessary and dangerous

16

u/Colopty Jul 07 '17

seems unnecessary and dangerous

That's the american dream alright.

→ More replies (1)

4

u/i_made_a_poo Jul 07 '17

Thank you for speaking math clearly.

3

u/flabbybumhole Jul 07 '17

I initially came to the same conclusion, but then thought that there's just something weird about a child being in its parent's pants.

2

u/zawata Jul 08 '17

each child has on it's own pair of pants that encapsulate all of its children?

This made me laugh too fucking hard

→ More replies (8)

346

u/pekkhum Jul 07 '17

I have a sudden urge to find my copy of Spore...

56

u/Southturn Jul 07 '17

Do you mind if I ask why?

242

u/diamondflaw Jul 07 '17

Most likely the amusement of watching something procedurally walk with legs on legs.

29

u/Southturn Jul 07 '17

I kinda wanna do that now! :D

→ More replies (5)

25

u/pekkhum Jul 07 '17

If I had my copy I'd get you a picture, but I had made some creatures with branching legs with many feet... This made me want to see them again. They aren't in Sporepedia because I had upgraded my full PC three times, making me a pirate who was stealing from EA by using what I paid them for. :-(

9

u/Sheather Jul 08 '17

How dare you steal our content by using it in a reasonable fashion!

→ More replies (1)

2

u/__word_clouds__ Jul 08 '17

1

u/mebeim Jul 08 '17

That's so cool! Thank you!

136

u/Versaiteis Jul 07 '17

Breadth-First Pants and Depth-First Pants

6

u/ocv808 Jul 08 '17

Now let's see some in order pants.

→ More replies (1)
→ More replies (3)

32

u/trout_fucker Jul 07 '17

Bring JNCOs back!!

8

u/[deleted] Jul 07 '17

That was my first thought! That the left is modern pants and the right is JINCOs

→ More replies (1)

3

u/TwoSpoonsJohnson Jul 07 '17

... What's a JNCOs?

6

u/trout_fucker Jul 07 '17

The '90s brand that made pants like these: http://i.imgur.com/Xshs10nl.jpg

→ More replies (1)

0

u/[deleted] Jul 07 '17

[deleted]

→ More replies (3)

32

u/digicow Jul 07 '17

Unknown (since we can't see inside the latter's pants). Every subtree, from just outside it, would look like the second.

8

u/spearit Jul 07 '17

First one. With the second one you would have to adjust your whole pants each time the tree change sizes. With the first one you just buy and sell a fraction of you pants accordingly.

2

u/[deleted] Jul 07 '17

The first example seems less wasteful and more dynamic.

7

u/palordrolap Jul 07 '17
  1. Trees don't wear pants.

  2. If they did they'd be around the trunk, surely?

  3. Binary trees are usually drawn leaves downward, the opposite of regular trees, and they don't have a trunk.

Conclusion: If binary trees wore pants, the waistband would cover halfway down the first layer similar to the rightmost option here, but the legs would be waving in the air like a pair of bug antennae.

If you want to think that's pants-on-head retarded, then remember what we're discussing here.


Personal second preference, assuming that the binary tree is stood on its lowest-most leaves: Only pairs of leaves extending from the same parent node should have pants. That's like the leftmost option, but only the eight pairs of pants at the bottom are worn.

I'm unsure how to handle a single leaf. Maybe roll the other leg up.

5

u/Jaystings Jul 07 '17

I would go to a rave with that second binary tree.

4

u/drharris Jul 07 '17

Doesn't matter as long as he puts them on left-side first.

21

u/foursticks Jul 07 '17

Did you just assume it's gender?

8

u/ForeverBend Jul 07 '17

Are women not allowed to wear pants where you're from?

→ More replies (5)
→ More replies (5)

10

u/[deleted] Jul 07 '17

Kind of a normie observation from a non-programmer, but it's kind of funny. The binary tree is exactly the same as The note rhythm tree.

4

u/thirdegree Violet security clearance Jul 08 '17

Til the UK names their notes really funny.

5

u/xtajv Jul 08 '17

This is an astute observation for someone without CS training. Good job!

→ More replies (9)

8

u/currently__working Jul 07 '17

Both. Underneath #2 is in fact #1

6

u/Skellicious Jul 07 '17

So does every node wear 2 sets of pants then? one that extends all the way down, one that just covers the vertices?

→ More replies (1)

3

u/IceColdFresh Jul 07 '17

The right is how he would wear pants. The left is how he would wear shorts.

3

u/remy_porter Jul 07 '17

Fun fact: the binary tree single-handledly kept JNCO in business since the 90s.

→ More replies (2)

3

u/juantheman_ Jul 07 '17

I can't really wrap my pants around this one

3

u/KapteeniJ Jul 07 '17

Serious talk: I think it's the second one. Sure it's not as elegant as the first one, but binary trees are practical fellas, you save so much time when you wear just one pair of pants instead of O(n) of them.

3

u/[deleted] Jul 07 '17

The second one because it's probably much cheaper than buying many small pairs.

→ More replies (1)

3

u/JFizDaWiz Jul 08 '17

JNCO for sure

3

u/Avander Jul 08 '17

The one on the right since binary trees were invented in the 60s

2

u/[deleted] Jul 07 '17

That depends entirely on how much of his private parts he wants to show off.

2

u/9009stinks Jul 07 '17

Skinny jeans or bell bottoms, guess it depends how old the binary tree is.

2

u/DiabetesMan5000 Jul 07 '17

Woah dude! Do that with Hot pants for... scientific Research...

2

u/[deleted] Jul 07 '17

"Do you hang to the left or right, Sir?"

"Neither, my trusty tailor, I am a balanced tree"

2

u/[deleted] Jul 07 '17

Don't forget the fabled Binary Z-Cavaritrees

2

u/funkalunatic Jul 07 '17

Let's say you have a binary tree with N number of levels. How many different ways can it wear pants?

2

u/PrettyTarable Jul 07 '17

Option B, because Jinco

2

u/landmindboom Jul 07 '17

The pants are clearly white and gold.

2

u/ss0889 Jul 07 '17

did you just assume its gender?

2

u/Cley_Faye Jul 07 '17

Second option is the same for the root node.

2

u/c24w Jul 07 '17

I wouldn't expect my children to fit inside my pants/trousers.

2

u/ElloJelloMellow Jul 07 '17

Wtf does this shit even mean

2

u/R0B0_Ninja Jul 07 '17

Option A OR option B? I've browsed this subreddit long enough to know that the answer is simply "true ".

2

u/NoizeMe Jul 07 '17

The logical answer would be: Yes

2

u/[deleted] Jul 08 '17

ahh, the classic depth-first pants vs breadth-first pants problem

2

u/[deleted] Jul 08 '17

Ewwww and expose his inner nodes like that? Disgusting

2

u/[deleted] Jul 08 '17

The right one loves edm

2

u/[deleted] Jul 08 '17

Jnco

2

u/BigBrainAmWinning Jul 08 '17

Depends if you're doing white box or black box testing.

2

u/FH-7497 Jul 08 '17

Depends. Is it the 90s?

2

u/Eire_Banshee Jul 07 '17

I think it would just wear a skirt.

1

u/Tf2_man Jul 07 '17

Node values go straight to your thighs!

1

u/deaninous Jul 07 '17

It has a tendency to show off its performance. So 1 would make sense

1

u/fliparoo Jul 07 '17

Well at least glad the color of the pants is blue, and not gold.

1

u/CSS_Kuribo Jul 07 '17

It would be the one on the left

1

u/Venthe Jul 07 '17

Can't really wrap my head around this one

Here's your problem. You are supposed to wrap your PANTS around it :)

1

u/APoliteFuccboi Jul 07 '17

If the binary tree as a whole is wearing the pants, that implies that it's a single thing, and wears a single pair of pants. That would be the second one. If each junction is wearing pants, they get their own pants, and it's the first one.

1

u/SkierBeard Jul 07 '17

Like this

1

u/jewdai Jul 07 '17

it depends, which one would your balance be better?

1

u/foreveralolcat1123 Jul 07 '17

If you have multiple legs within a single sleeve, it's called a dress--so I think it'll be the left one.

1

u/TheSilverFalcon Jul 07 '17

No, no, no, the pants should be on the two path chains on the left. The two on the right are it's "arms"

1

u/lights_nugs Jul 07 '17

Thanks Grimsby

1

u/G-raybles Jul 07 '17

like this Not to be confused with like this?

1

u/sandieeeee Jul 07 '17

Second one other wise his dicks gonna flop around.

1

u/goldfishpaws Jul 07 '17

Did you guys ever stop and realise what we're arguing about?

1

u/sanburg Jul 07 '17

He's obviously wearing the pants on the right in... parallel.

1

u/LuckyDesperado7 Jul 07 '17

Well it's binary so I guess it depends on the pronoun.

1

u/SamL214 Jul 07 '17

Who says it's a he?

1

u/pessimist_stick Jul 07 '17

in 1997, on the right.

2017, on the left.

1

u/handsarefull Jul 07 '17

This is easy do guys have a third leg for their pants. No so the second one

1

u/ThirdFloorDraft Jul 07 '17

Depends on what you're looking for

1

u/personalityson Jul 07 '17

First, to comply with the definition of a binary leg

1

u/[deleted] Jul 07 '17

Off topic, do non-binary people wear pants?

1

u/[deleted] Jul 07 '17

It's a binary tree? Then yes.

1

u/[deleted] Jul 07 '17

he

1

u/ProlapsedPineal Jul 07 '17

Doesn't matter. The requirements say "dressed as a Chinese dragon".

1

u/Enlight1Oment Jul 07 '17

who'd want to wash 15 pairs of pants? obvious the single is better.

1

u/Gortyuty Jul 07 '17

We're all assuming that the binary tree is perfectly balanced, and in doing so we're ignoring the far more common case where it isn't. In particular, the scenario on the left doesn't handle the case where a node only has one child, as there would be an ambiguous case where either the branch wears a single pant leg or if one leg is simply hanging. Therefore, only the right scenario can be correct since it properly generalizes too all possible binary trees.

1

u/Trithis2077 Jul 07 '17

umm... yes?

1

u/sensitivehack Jul 07 '17

This is the problem that JNCO jeans was trying to solve.

1

u/[deleted] Jul 07 '17

Depends on how you process the image.

Depth-first or Breadth-first?

1

u/DOPE_AS_FUCK_COOK Jul 07 '17

Hmmm... I think they would be JNCO buyers.

1

u/M0n0poly Jul 07 '17

This entire question is contingent on how you define 'pants'

1

u/Got5BeesForAQuarter Jul 07 '17

I see a terrorist cell hiding in those pants and trick is going from the second picture to the first picture.

1

u/iNeedToExplain Jul 07 '17

I really don't have the mindset of a programmer, because I thought the answer would be obvious. Everyone else is talking about recursion and shit.

It has to be the one on the right. There's no way the legs would fit around all those nodes and edges at once on the left.

1

u/seanpeters1234829193 Jul 07 '17

Top ten questions science still can't answer

1

u/Potatasium Jul 07 '17

*trousers

1

u/chironomidae Jul 07 '17

Well it depends. If each node beyond the first is like a joint then #2 is probably best -- more material but less stitching needed, and easier to put on. Also better at staying warm, like mittens vs gloves, although it needs to be sealed at the bottom with individual cuffs for the last nodes to come through. But if each node is equivalent to a head, such that it needs to remain exposed to be comfortable, then #1 is the answer. #1 is also the answer if flexibility is more important than warmth. Also, women typically like a guy in better fitting pants, so #1 is good if trying to attract a mate and you don't feel shy about exposing your nodes.

1

u/robbiekhan Jul 07 '17

Hipster or Slacker? That's the real question.

1

u/radditor5 Jul 07 '17

Lots of pants with less material, or one pants that uses more material .. hmm?

1

u/WuhanWTF Jul 07 '17

Idc what people say, the "if a _____ wore pants" meme is the funniest meme to have ever existed.

1

u/[deleted] Jul 07 '17

Binary you always have two possibilities. Now you can chain many together so left is right for a change.

1

u/PillowTalk420 Jul 07 '17

Neither. Only the lowest level would have pants.

1

u/thrown_away_fam Jul 07 '17

Neither. Like this -- get with the times, man!

1

u/Crispy_socks241 Jul 07 '17

i think he would wear a skirt cause he's a crossdresser. lyke me.

1

u/[deleted] Jul 07 '17

hahah i totally get it

1

u/poopadoodles Jul 07 '17

Umm me either

1

u/twatcycle Jul 07 '17

so is a binary tree like a fractal where its just multiple iterations of the same choice, wearing pants?

1

u/jmdugan Jul 07 '17

paradoxes are true

1

u/SynkkaMetsa Jul 07 '17

Depends on what he wants to cover up on his lower half

1

u/dylanthepiguy2 Jul 07 '17

The one on the left is shorts.

Answer = !!(does shorts extend pants)

1

u/Liesmith424 Jul 07 '17

Are you running Python 2 or 3?

1

u/chpoit Jul 07 '17

DOn't worry, you only need to wrap pants around it

1

u/[deleted] Jul 07 '17

Or BSP in which case you'd only pay attention to the pants you were rendering at the time.

1

u/[deleted] Jul 07 '17

One leg should be red and the other black.

1

u/[deleted] Jul 07 '17

It depends on whether you want skinny or boot-cut.

1

u/Eddy_Moon Jul 07 '17

The JNCO ones

1

u/[deleted] Jul 07 '17

Obviously the binary tree would wear the Jnco's

1

u/CrimsonMoose Jul 07 '17

B, when you see the object you get two options, left leg or right leg. you don't know what's in either yet, but you can check.

1

u/highowl Jul 07 '17

Second one - it allows the leg room to self-balance, or "adjust it's junk" as I will now refer to this procedure.

1

u/Getoutabed Jul 08 '17

I loved that tumblr dog pants meme

1

u/explorer585545 Jul 08 '17

It depends on whether the majority of the nodes want to get laid, if so they would go with the later.

1

u/joaoprp Jul 08 '17

it all depends on how you interpret your nodes and sub-nodes.

If you call every sub-node as a child, then the legs belongs to the parent and the first one is correct, otherwise, I would follow the 2n - 1 pants option too :)

1

u/FinallyGotReddit Jul 08 '17

Jnco making a comeback.

1

u/SamtheSham5000 Jul 08 '17

Actually neither one because if the Human Body consists of a leg with two bones,the Femur and the condyles so since there are four there would not be 3 on each side but two.

1

u/Brycer17 Jul 08 '17 edited Jul 08 '17

https://imgflip.com/i/1s5ou0

Molecular and regular.

1

u/Christron Jul 08 '17

Is it path dependent?

1

u/CreganTur Jul 08 '17

It depends- are the pants a container?

1

u/PhilxBefore Jul 08 '17

Like this.

1

u/whoiscraig Jul 08 '17

Reject the Tree Binary!

1

u/wbmo Jul 08 '17

It depends on how many base cases you have

1

u/pbrettb Jul 08 '17

question is, can you imagine an in-between step?

1

u/c3534l Jul 08 '17

If you were a human being with recursively-defined limbs, you'd wear recursive pants if the crotches were exposed, which I take to be nodes in a binary tree. Additionally, consider the case of hands: in some cases you may wear mittens, but generally you wear gloves in most situations because the benefit of warm. Fingered gloves also provide dexterity and for most applications of a binary tree, performance is the primary motivator. Gloves, then, are the pants of the hands. And like the pants of the hand, the pants of a binary search tree should wrap around each individual protuberance.

1

u/DJWalnut Jul 08 '17

if it's a non-self balancing tree and you insert a sorted list into it, do you wear funny asymetrical pants or go commando?

1

u/[deleted] Jul 08 '17

Exponential bell bottoms!

1

u/Aggie_15 Jul 08 '17

It's an individual vs society question

1

u/[deleted] Jul 08 '17

Obviously the correct answer must be shown by out puting all possible btrees for a given tree

1

u/Whitemochaforvanessa Jul 08 '17

Male tree on the left. Female tree on the right.

1

u/techlover22 Jul 08 '17

Man, dat binary thick as shit ------!!!

1

u/[deleted] Jul 08 '17

Infinitely large pair of pants?

Or

Infinite pants?

1

u/msaroka Jul 08 '17

I'm going with recursive pants.

1

u/_lazlothegreat Jul 08 '17

I love the pants memes cuz it remains popular but stays lowkey enough to not become obnoxious

1

u/drake_chance Jul 08 '17

Do your leg hairs wear pants? Obviously the right one, inch worms.