This article contains affiliate links. See my affiliate disclosure for more information.

You can do a lot with very little.

Modern, high-level languages abstract away lots of details. You don’t need to know the difference between selection sort, bubble sort, merge sort, and quicksort, for instance, to use Python’s sorted() function. It just works.

Do you really need to learn how to use data structures and algorithms?

This article was originally published in my Curious About Code newsletter. Never miss an issue. Subscribe here

Well… I've got news for you:

You're already using algorithms and data structures

Ever used a string? That’s a data structure. Written a for loop? That’s an algorithm.

Algorithms and data structures are the building blocks of computer programs — even “Hello, World!” Over time, programmers recognize useful patterns they can apply to a broad range of problems. Language designers bake the most commonly used patterns into easy-to-use interfaces.

You don’t have to know how they’re implemented to reap the benefits.

New coders, especially, need to avoid falling off the deep end.

Focusing on data structures and algorithms too early is a mistake

Let’s be realistic.

You can solve at least 95% of coding problems without any deep knowledge of algorithms and data structures. Beginners need to focus on learning syntax and getting proficient at translating ideas expressed in a human language into code. You don't want to spend all of your energy on something with little immediate impact.

But here’s the rub:

Ignoring algorithms and data structures is risky

You could end up with your hands tied.

You may write code that works fine in small settings but screeches to a halt on larger workloads. You have a scalability problem. Or you may become so dependent on third-party packages that you can’t solve problems that hit edge cases. You have a specialization problem.

Not everyone that drives a car needs to be a mechanic, though. So how do you know it’s time to take the plunge?

Sometimes data structures and algorithms are crucial

Will your code need to:

  • Scale to millions of users?
  • Process enormous amounts of data?
  • Run on a system with tight memory constraints?

In each of these scenarios, data structures and algorithms are vital. Not because you’ll need to write everything from scratch — although, you might — but because you’ll need tools to evaluate and compare solutions. For some projects, it can be the difference between success and failure.

But there's another reason to learn algorithms and data structures.

One that every coder should know:

Algorithms and data structures are beautiful

One of my favorite quotes about art is from the English painter David Hockney:

Art has to move you, design does not, unless it’s a good design for a bus.

A good algorithm is a work of art. The ingenuity of its inner workings, the cleverness with which it skirts constraints, can elevate an algorithm from the mundane to the downright magical.

Yes, studying algorithms and data structures may be necessary for your career.

Then again, it might not.

But not everything worth learning has to be immediately useful.

See how to utilize recursive algorithms and data structures like hash tables and trees to build an anagram generator in Python:

Tree Traversals And Anagrams In Python
A weekend project exploring hash tables and recursive algorithms.

Dig Deeper

Learn about several important and foundational algorithms in Aditya Bhargava's friendly and accessible book Grokking Algorithms. It's full of fun (and useful!) illustrations, and easy-to-digest explanations with example Python implementations.

Get instant access from Manning, or buy a print version from Amazon.