DEV Community

Joe Eames for Thinkster

Posted on

Do You Need to Know Data Structures & Algorithms?

One question a lot of developers continue to struggle with as they start and advance their careers is the question of the importance of Data Structures & Algorithms.

Do you need to know what a hash is and how to implement it?

Do you need to know how to do a quicksort?

Well, after 22 years of professional programming without having a CS degree, I can definitively say that the answer is a clear and unambiguous Yes and No.

Let me take a quick aside and define “data structures and algorithms”. If you already know this, skip this paragraph. “Data Structure” is the study of various programming data structures (duh) and what they do, how they work, the tasks they’re fast at, the tasks they’re slow at, and their various features. “Algorithms” refers to the study of the program fragments that solve low-level problems like searching and sorting through any of the above data structures, and which algorithms are most performant in different circumstances. There’s a large body of academic studies and amazing books about these subjects.

Now, here’s the problem with the above question: In 22 years, I’ve never implemented a linked list in any program I’ve written. But I constantly choose whether to use an object or an array to hold some data or state. And that choice matters. Both objects and arrays can represent collections of data in JavaScript, but knowing when and how to use each is pretty important.

Most of my knowledge of data structures and algorithms have been slowly built up as I have written code over my career, combined with some occasional academic reading. I pretty quickly learned binary search. Understanding that has helped me in several cases, but I don’t think I’ve ever implemented a binary search on my own. Most of what I know about data structures & algorithms, I learned without knowing that I was actually learning data structures and algorithms.

I personally find the topic an interesting and engrossing subject. But I also find that most of the time, any academic study I’ve done is not as directly useful as learning a new library or technology. Generally, learning this stuff has a sort of “passive” benefit on your development. The nice thing is, this knowledge crosses frameworks, techniques, and languages. Anything you learn will benefit you regardless of what you are currently writing.

So, back to the original question: Do you need to know them to be a good programmer?

You will definitely benefit from making a concerted effort to learn them, but that’s something that can be slowly mixed into your career. And learning other development topics, like current best practices, new languages and development paradigms, current tools and techniques… all of these will benefit you as well. So you shouldn’t ignore these other things just to become an absolute expert on red-black trees.

Signup for my newsletter here.

Visit Us: thinkster.io | Facebook: @gothinkster | Twitter: @gothinkster

Top comments (1)

Collapse
 
anilmirge profile image
Anil Mirge

I can't agree more. The fact that big tech giants focus tremendously on Data Structures and Algorithms says it all. It's critical that a developer understands clearly what data structure to use to store a particular data and how good his algorithm performs specially with a colossal amount of data with the current trend of the speed at which data is accumulated even before we get into data science or AI and machine learning.