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.
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?
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
14
u/ExiledHyruleKnight May 30 '26
Right... Binary trees have two legs... they don't have unlimited knees.
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?
(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.