Why do companies ask algorithmic questions on job interviews?

First of all, not all of them do. In your local outsourcing company nobody cares about pyramidal sort, they just want to be sure that you can do your job. This is why they are not likely to include algorithms in the list of interview questions.

However if you read books like Cracking the Programming Interview you will see that they are full of algorithmic puzzles. ┬áIf you want to be hired in Google or Facebook you need to be a super-geek and you need to be prepared to dedicate around half a year to learning algorithms. Otherwise you’re likely to fail at the technical interview.

For some reason they love algorithms and they give algorithmic questions to all the potential employees, even the frontend developers. Why do they do that?

There’s a huge debate about how useful the algorithms are in your everyday job. I personally think that they are not useful at all for the frontend developer but I maybe wrong. In the end, it doesn’t matter.

Imagine that you’re Google and you’ve opened the position of Javascript developer. And suddenly you have 1000 candidates from all over the world trying to get in. Can you afford to spend two thousand hours of your employees to interview them all? Of course not.

That’s why you need to filter those guys, and you can use statistical methods for that. Imagine the world in which people with big ears tend to be better developers. In other words the probability p that the developer is good is higher if you have big ears.

Two programmers with different ear sizes

We don’t know why is it, but every time we take 1000 programmers with big ears, 8000 of them are good in programming. And every time we take 1000 little-ears programmers only 4000 of them are good. We don’t understand why does this correlation exist and we have no idea which role the ears play in writing efficient code. At the same time if we need to pick ONE person from a hundred candidates we will be eager to show the door to our little-eared candidates.

And that’s pretty much what’s going on with the algorithms. We can’t prove that they are useful in everyday programming job, but we know for sure that the ratio of good to bad programmers is higher among those who mastered algorithms. That’s why, if the amount of candidates is big enough, the company can afford to include some algorithmic stuff to their list of the interview questions.

So next time you prepare for your job interview and feel how useless the knowledge of algorithms is, tell yourself that it’s just statistics. You can’t make your ears bigger but you can learn quicksort.

Leave a Reply

Your email address will not be published. Required fields are marked *