Live data from Hacker News

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

thecodebarbarian.com

51–60 of 115 posts

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

#51
post #38
post #28

Earlier quoted context omitted.

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.

How do you represent hierarchical data in a single hashmap?

You can frequently buy a performance increase by representing nested calculation logic in hashmaps via memoization.

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

#53
post #11

Earlier quoted context omitted.

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.

Reversing a binary search tree is a binary (pun intended) answer: you either know how to do it because you learned it in college/read Cracking the Coding Interview, or you don't.

They also teach things like this in boot camps now. The graduates are trained to game these tests because placement rates are so important to boot camps.

Assuming someone is a good programmer because of trivial examples like reversing a binary tree or, worse, writing a bubble sort is like asking someone you to use a wrench to prove that you're an architect.

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

#54
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.

So this article leads off with @mxcl's tweet about google not offering him a job because he wasn't able to reverse a binary tree on a whiteboard.

I don't think that being able to describe an algorithm you haven't had to implement in more than decade (at least, that would be the case for me, college is starting to be a long time ago for me).

Honestly right now, without looking up the answer, I probably can't reverse a binary tree on a whiteboard. I could, however, do it by test driving a solution with a real computer (I haven't flexed those muscles in a long time, but test driving would help me dig into the recesses of my brain).

Which skill set is more useful for production quality software? I can say for sure that it's not white boarding.

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

#55

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 ? Programm…

I think most people here miss the point, thinking that they need to know about symmetric binary trees in order to be able to answer such questions.

These kind of tests are aiming to find developers who can think out of the box and start solving problems they haven't heard of before. This is quite a simple problem to solve if you start thinking about it. If you get stuck because of the binary tree and because you've never done that before, then I believe you would be a mediocre dev (which is not a problem in many companies).

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

#56
post #34
post #2

I lost him at: "I think homebrew is an awful piece of software that should never be used by anyone."

I wish he'd give some points as to why Homebrew is an awful piece of software. To date, I've had 0 issues...

IIRC homebrew doesn’t handle inter-package dependencies very well - it’s no apt - but apart from that it seems to mostly work OK.

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

#57

It's all about context. If your software team works on code with lots of binary trees, interview questions about them makes a ton of sense. If your software team is making a website that just displays stuff from databases and web services, interview questions about binary trees makes no sense at all.

> If your software team works on code with lots of binary trees, interview questions about them makes a ton of sense.

Not really, because anyone reasonably competent could be up to speed on tree operations in an afternoon on the job. Interviewing them to see if they already know likely takes more energy than having them learn about them.

That holds true for lots of things. "You say you haven't used GitLab. Too bad: that's what we use so we'll have to hire someone else." "Huh? I'm pretty sure I can figure it out in a couple of hours." "Nope. We need someone ready to hit the ground running."

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

#58
He undermines his own point by pointing to dictionaries as an example of something that uses trees. Which suggests that he doesn't know that dictionaries in most languages are implemented as hashes, and hashes are NOT based on trees!

The truth is that interviews should test the skills your job actually requires. For a variety of skills outside of that core, it is valuable to have someone on your team who understands it for other people to go to. But if you're not doing algorithms all the time, you don't need or want everyone to have mastered that.

And I say this as someone who knows algorithms well enough to pass his interview.

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

#59

I think some folks get hung up on the idea that the answer to one question can be used as a go/no-go for a hire decision. Its never that simple, there's a lot more to consider, and the vast majority of candidates will bomb a technical question or two eventually. For those of you that are job hunting right now... don't get bent out of shape, there are plenty of employers that won't hinge their acceptance on one techni…

Boom. I do ask at least one code it on a white board question usually, and what I don't do is sit back twiddling my fingers and think to myself, he/she gets this or else. I actually don't mind at all when a candidate doesn't know it and asks me for help - provided they've made some good faith effort. That's why we have so many other questions and conversations. By the time I get to the whiteboard stuff, I'm looking for someone to want to engage with me, not an attempt to stump them.
Post reply on HN