Should You Learn Data Structures and Algorithms?

You could reasonably argue that data structures and algorithms are at the heart of computer science. This leads to the widespread belief that they are also at the heart of software development and that a detailed or even profound knowledge of them is necessary to be a decent programmer. I believe that while it doesn't do any harm to learn them in depth it is not the best use of your time.

According to Wikipedia:

"Programming involves tasks such as: analysis, generating algorithms, profiling algorithms' accuracy and resource consumption, and the implementation of algorithms in a chosen programming language".

That is a heavy emphasis on algorithms!

I find Wikipedia very useful on an almost daily basis but a criticism I have is that it can have a very theoretical and academic emphasis. This may be due to the type of people who write articles for Wikipedia or it might be a deliberate policy. Either way I think it is out of touch with the needs of typical users.

Many people wishing to get into programming, either as complete beginners or after having done a bit of coding, are going to want to get a deeper insight into what it's all about. Being told it revolves around algorithms (and the closely associated topic of data structures) is both misleading and offputting.

Assuming they don't think "that sounds too boring/too difficult, I'll find another career" they might start searching out books or tutorials on data structures and algorithms (every major language seems to have a book called "Data Structures and Algorithms in {{language}}") thinking that once they learn a language and how to implement data structures and algorithms in it they will have this programming thing pretty much wrapped up.

You are very unlikely to ever need to implement a datastructure. JavaScript gives us the highly versatile Array (which isn't really an array, but that's another story...), Python provides lists, tuples, sets and dictionaries, the .NET Framework spoils us with a large, partly overlapping and partly obsolete set of datastructures, and so on.

However, it is necessary to understand the different types of data structure, what they are for and how they work, including some of the more esoteric ones. That way you will know which one to choose even if you never have to write one from scratch.

Of course you could argue, quite reasonably, that the best way to understand data structures is to implement them. You could do just that but would that be the best use of your time? I would say not.

Now let's look at algorithms, the archetypal ones being for searching and sorting. The need to search or sort data structures is so common that any language, framework or database is going to provide this functionality as standard. Therefore unless you end up being one of the small number of people who actually write these languages, frameworks or databases then the chances of having to implement them are remote. And unlike data structures you don't usually get a choice so understanding which is best in a given situation is not necessary.

Despite that many interviewers are lazy and unimaginitive and decide to ask interviewees about sorting algorithms, perhaps assuming that if a candidate understands something "deep" they will understand the higher level everyday stuff.

So should you learn the main sorting algorithms just in case you are ever quizzed about them in an interview? Or should you give them a miss and decide that if you are asked you will just say "I'm sorry, I don't want to work for somebody who is so lazy and unimaginitive that they ask questions about sorting algorithms." The choice is yours...