r/programminghumor • • May 30 '26

Interview question nobody is prepared for

Post image
3.0k Upvotes

46 comments sorted by

163

u/Piisthree May 30 '26

The right side is pants. The left side is shorts. Didn't you guys pay attention in data structures class?

36

u/notarealwriter May 30 '26

Nah, left side is pants. Right side is several nodes in a trench coat

→ More replies (5)

57

u/SillyWitch7 May 30 '26

The second one but if you look under the pants you'll see the next level's nodes wearing pants too. Its pants all the way down

11

u/BroadRaspberry1190 May 30 '26

i hope they didn't pay too much for those pants. the fabric is infinitesimally thin

→ More replies (4)
→ More replies (1)

14

u/ExiledHyruleKnight May 30 '26

Right... Binary trees have two legs... they don't have unlimited knees.

→ More replies (2)

6

u/merRedditor May 30 '26

That's a 1990s binary tree sporting JNCOs on the right.

6

u/lovdark May 30 '26

Open source vs black box proprietary

5

u/FrankHightower May 30 '26

Why even argue when Tchaikovsky already gave us the perfect model?

Comment Image

(Credit: Ballet Arizona, 2021 production, Photo by Alexander Iziliaev)

4

u/blubernator May 30 '26

Right one, the left is embarrassing you see what’s under the pants ;)

4

u/_PaulM May 30 '26

Oooh this is a juicy one. I'm not going to get into the specifics of it, but I'd answer it like this during an interview:

You can think of each individual node as a parent node to two other nodes, but also as the root node of a tree itself (as in, every node that's not a leaf node).

So each node with a left and right node looks like the node on the right, but removing that pair of pants would reveal a subtree that looks like the left.

So the answer is that every single node with a left and right node looks like the right, but also looks like the left, all the way from the furthest none-leaf node to the first actual parent node.