← Back to context

Comment by johannes1234321

8 years ago

Well, inverting is a trivial operation, pseudo-implementation: swap(left, right); recurse(left); recurse(right);

If one doesn't know what is meant one can talk to the interviewer and get a hint about what is meant. It can be that the interviewer is bad and misleading, but usually they have some specific training, this seems unlikely as the candidate didn't complain about the interviewer but admitted he had no clue.

The follow-up question would probably be the question about the complexity, that is also trivial f you know fundamentals of big O notation, as one has to walk over each node.

It's hard to find a more trivial algorithms question. Algorithms are fundamental knowledge for programmers (other than script kiddies)