Live data from Hacker News

I Don't Want to Hire You If You Can't Reverse a Binary Tree

thecodebarbarian.com

21–30 of 115 posts

Re: I Don't Want to Hire You If You Can't Reverse a Binary Tree

#22
post #11

Couldn't disagree more with the author. How many developers need to implement their own binary-tree? This is why code-bases become convoluted with six different implementations of standard data structures.

That's missing the point of the article. The author says that the candidate's thought process behind arriving at the solution provides insight into the candidate's skill. There's no reason to implement your own binary tree, but knowing how to devise algorithms to accomplish a given task is a necessary competency.

> knowing how to devise algorithms to accomplish a given task is a necessary competency

Agreed. Why not use a realistic problem and setting?

Re: I Don't Want to Hire You If You Can't Reverse a Binary Tree

#24

Sigh. If you hire using know it or not questions about binary trees, then you finally get to hire people who can study up and answer that specific question in a manner Pavlov would approve of. That does not mean the candidate will be able to design clean APIs, know how best work with different types of data, or even how to troubleshoot existing code. Still, pat yourself on the back, I mean, your entire team can answe…

> If you hire using know it or not questions about binary trees

The article author doesn't think of his question as a "know it or not" question, but a "you should be able to figure this out" question:

> Here's the first reason why this question is so good: a skilled programmer can map their intuition to code. You can tell at a glance whether a binary tree is symmetric, but beginners will often struggle with a question like this because they approach this problem from a visual/intuitive angle rather than the logical angle.

I think it's a fair criticism to say that, at this point, "reverse a binary tree" is something a lot of applicants will have simply memorized rather than figuring out on the fly. But (to play Devil's Advocate) isn't the goal of the question - to test a candidate's ability to think logically and problem-solve on the fly - a reasonable one?

It seems to me the real problems with whiteboard-coding interviews aren't that what they're trying to test - problem-solving on the fly - isn't useful or valuable, but that whiteboard coding is confounded by so many irrelevant variables: ability to think under pressure, ability to code "in your head" (without an editor, IDE or REPL), memorizing solutions, and so forth.

Re: I Don't Want to Hire You If You Can't Reverse a Binary Tree

#27

Sigh. If you hire using know it or not questions about binary trees, then you finally get to hire people who can study up and answer that specific question in a manner Pavlov would approve of. That does not mean the candidate will be able to design clean APIs, know how best work with different types of data, or even how to troubleshoot existing code. Still, pat yourself on the back, I mean, your entire team can answe…

At the very least, it means they studied up on the tricks. That's good for something.

Re: I Don't Want to Hire You If You Can't Reverse a Binary Tree

#28

Couldn't disagree more with the author. How many developers need to implement their own binary-tree? This is why code-bases become convoluted with six different implementations of standard data structures.

Well, to pick on Valeri, this is simply wrong

   Trees are the single most important data structure in computer science. Just 
   about everything you do in your programming career will be related to trees.
Trees are a horrid data structure for any modern processor. Pointer chasing thrashes caches. The actual most important data structure is a hashmap. The same speed in theory, much faster in practice.

Re: I Don't Want to Hire You If You Can't Reverse a Binary Tree

#29

Sigh. If you hire using know it or not questions about binary trees, then you finally get to hire people who can study up and answer that specific question in a manner Pavlov would approve of. That does not mean the candidate will be able to design clean APIs, know how best work with different types of data, or even how to troubleshoot existing code. Still, pat yourself on the back, I mean, your entire team can answe…

How is that a "trick" question? I never been asked that in an interview question and had the correct solution in my head in just a few seconds for the very reason he gives -- experienced programmers can map their intuition to code. This is certainly a skill that takes time to develop, and if you're concerned with hiring the best, don't you think this is a decent heuristic to throw in with a bunch of others?

Programmers are so sensitive, and honestly all your "sighing" is obnoxious. You don't have it all figured out.

Post reply on HN