Hacker News new | ask | show | jobs
by sloaken 1858 days ago
So I had to look up what 'invert a binary tree' meant. I was thinking make the leaves roots and the root a leaf, which made no sense.

So flipping the left and right, no I have never had to do that. I have had to write algorithms that processed the tree in infix, prefix and postfix order. And I have had to do it backwards, which is kind of the same but I never changed the tree for that.

As far as an interview question it is testing 2 things, 1) do you even know what a binary tree is, 2) are you comfortable with recursion. And in my case 3) are you willing to admit you do not understand and need an explanation.

From an interview perspective, all 3 are viable questions.