Is it worth learning algorithms?

One of the most popular questions in tech industry is: is acing at solving algorithmic problems worth the effort?

###DEFINITION First let’s start by defining what an actual algorithm is. According to Wikipedia, the definition of an algorithm is: In mathematics and computer science, an algorithm is a self-contained step-by-step set of operations to be performed. An algorithm is an effective method that can be expressed within a finite amount of space and time and in a well-defined formal language for calculating a function. An efficient algorithm is one that will solve the problem at hand with the minimum amount of space and time occupied. In programming, algorithm complexity is calculated using the Big O notation.

###MASTERY A very important concept in learning is MASTERY. How can you achieve mastery and specially how can you achieve mastery in solving complex problems using algorithms? According to different scientific discoveries, mastery can be achieved after 10.000 hours of practice. If we were to practice in average 2 to 3 hours every day we would achieve mastery in approximately 10 years. Robert Greene describes in better detail how mastery can be achieved in his book called Mastery.

###MASTERING ALGORITHMS As with any other field, achieving mastery in solving complex problems using algorithms requires a great amount of practice. These days you can find lots of websites that can help you find challenging problems to solve, most popular of them being: TopCoder and ProjectEuler. They both contain a great amount of problems to be solved so there is a lot of good material to achieve your 10.000 hours of good practice.

###DOES MASTERING ALGORITHMS MAKE YOU A BETTER CODER? There are different reasons for which you may want to start learning algorithms and data structures. Most popular are: wanting to score a job at a big company, in order to become a more complete programmer or simply in order to participate in competitions. Note that the last reason will not help you by any means becoming a better coder since you have to solve complex problems in a relatively short amount of time, so coding style is not taken into consideration. For the other two reasons, algorithms learning can help you understand how to solve different types of problems and also how to efficiently use different data structures. Will they make you a better coder, probably not. Will they make you a better problem solver , most certainly.

###BETTER CODER vs. BETTER PROBLEM SOLVER It is very important to make a distinction between better coder and better problem solver. In order to write better code you must take into account different coding principles like code re-usability, code maintaining, test driven development and so on. You can learn more about clean code principles in Robert Martin’s book Clean Code. A good problem solver is not necessarily a good coder the same way as a good coder is not necessarily a good problem solver. In my opinion a good programmer is both a good coder and a good problem solver. I also strongly believe that you don’t need to master algorithms in order to be a good problem solver, but you need to have an idea about what an efficient algorithm is as well as knowing how to use data structures efficiently. Note that the proper use of data structures in most cases can improve an algorithm efficiency.

###IS IT WORTH DOING THE WORK? Depending on what you want to achieve it’s worth more or less to invest a lot of time in learning and mastering algorithms. I think it’s worth doing some courses and reading at least a book about this subject in order to understand algorithm complexity and efficient data structures usage. It will also help you gain more self confidence when it comes to job interviews, as most big companies ask you to solve some algorithmic problems. Personally I don’t agree with this type of interview since it doesn’t reveal if the person is a good coder, if he is a good fit for his future team or if he will be able to adapt in the company’s environment and all these things are more important than mastering algorithms when it comes to work for a company inside a team. If you plan to participate in coding competitions then mastering algorithms is key.

###CONCLUSION In conclusion I think a minimal knowledge of algorithm complexity and efficient use of data structures should be enough. I think nowadays you have a plethora of programming languages and most of them serve a good purpose. So being competent with multiple useful programming languages according to your specialization is more important no matter if you are going to work in a corporation or build your own thing. I also think that finding a specialization and getting specialized in a certain domain like web or mobile is more important. You need to be a polyglot but also you need to be specialized in a branch in order to produce quality software. Bellow I will list a few good books and courses I have read in regards to algorithms. Please leave a comment if you agree or not with my view and also if you have links to better materials than the ones listed bellow.

##Great overall algorithm books:

Steven Skiena - The Algorithm Design Manual

Donalt Knuth - The Art Of Computer Programming

##Good for job interviews:

Gayle Laakmann McDowell - Cracking the Coding Interview

##Good online courses:

Stanford: Algorithms design and analysis Part I and II

Princeton: Algorithms, Part I and II