The Algorithm and Data Structures Conundrum

by abhirama

Hacker news denizens have a penchant for articles on hiring. Every once in a while, a post appears on the home page followed by a passionate and vituperative debate. People conversing on this can be divided into two camps; one argues that math, algorithm and data structures are critical and interview candidates should be quizzed on them while the other group takes the opposite view. If you are not privy to these conversations, I highly encourage you to go through them.

In my opinion, these discussions miss the real essence of the issue. The question is not whether algorithms and data structures are a requirement for a programmer, it goes without saying it is. What we should debate is the depth of knowledge someone should have on these to be effective at their day to day work. Are we after someone who knows the different sorting algorithms and has a fair understanding of their trade-offs? At work, if this person faces a tricky problem, she knows where to start and then reaches out to Google to aid her? Or, do we want someone who can go to the whiteboard and code the algorithm from scratch and explain the math and computational complexity right in the interview? I can very confidently say that for most of the day to day work, you do not need to ponder on the mathematics behind algorithms and complex data structures. What is required is sound coding and design skills, tenacious curiosity, and a passion for excelling.


What do I mean when I say sound coding skills? The very basics; splitting lengthy code into modules, appropriate comments in the code, test cases, following code conventions and the spirit of the programming language. The above is the foundation of a great project and has a tremendous impact on the future of the project. If you do not follow these basic tenets of programming, scaling the project and modifying it in future becomes a project of its own.

Good design is what helps you scale your application as the business needs change and user base expands. In a web project, a good design would be to have business logic in a separate layer and not tying it up with controllers and views. I have personally seen this helping us at burrp! where we rolled out our mobile app in a month as our backend was flexible enough to support a new interface with minimal changes. If our design was not good, there was no way we could have developed a mobile app which had most of the functionalities of our website in such a short period.

Now coming to the most critical part, curiosity. Why is curiosity such an important trait? Without curiosity, we stagnate. We become complacent. We do not innovate. We do not try to become incrementally better. We think what we know is the ultimate truth and whatever language/framework/methodology that we use is the best. I have interacted with professional programmers who were not aware of PHP which powers a substantial number of websites.

If you are tenaciously curious, when faced with a problem, you start obsessing about it. You see it as a puzzle that has to be solved. For example, if you feel that a part of your code is slow, you dig deep into it and try to figure out what is happening. In this process, you come across people who have faced similar issues and solved the problem using a better algorithm or data structure.

I would say interviews focused heavily on data structures and algorithms are biased towards new college students and people who are just preparing for interviews. Most of these questions are in no way novel. Go to one of the interview preparation sites, spend a couple of days trying to solve the problems and suddenly you become an algorithm and data structures expert. Just because FANGs ask these kinds of questions in their interviews, everyone has adopted this interviewing style, and it has got to a point where interviews are more about showing off the interviewer’s data structure and algorithm skills rather than evaluating whether the person on the other side of the table is a good fit for the job. Also, an unhealthy side effect of this is that in a fury to concentrate on algorithms and data structure skills, everything else gets sidelined.

Unless you are working on some cutting-edge niche project, you do not need people who can whiteboard algorithm and data structure problems in interviews. Hiring people who are infinitely curious and can get incrementally better will give you a much better bang for your buck.