The Truth About Algorithms and Data Structures

somacdivad

David Amos

Posted on September 23, 2022

The Truth About Algorithms and Data Structures

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?

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.

Two people trying not to step in puddles. The person on the left says: "Dude, these puddles are everywhere!" The person on the right responds: "There's no escape!"

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 most 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.

People in a row boat stuck on a rock. The captain says "What do you think the most efficient way around this rock is?" One of the rowers responds: "Maybe we should just learn how to row first."

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.

Person tripping over an oversized hourglass, dropping their laptop, and exclaiming "Where did THAT come from?"

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.

Man working on a computer with a screwdriver saying "Time to dig in!"

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.

A group of people viewing an "algorithm" in a museum. The guide says "This one is over 2300 years old and is still in use today." One person in the group says: "Whoah!"

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.


Here are some of my favorite books on algorithms and data structures:

For the curious beginner:

For folks who want to dig deeper:

For folks who want all the details:


Become a better coder in 5 minutes.

One email, every Saturday, with one actionable tip. Always less than 5 minutes of your time.

Subscribe here

💖 💪 🙅 🚩
somacdivad
David Amos

Posted on September 23, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Minecraft: A Janela para a POO
development Minecraft: A Janela para a POO

September 6, 2024

Memory Handling in Java
java Memory Handling in Java

March 4, 2024

Celery: Python's Silent Hero
python Celery: Python's Silent Hero

October 1, 2023

Pair Programming
programming Pair Programming

May 7, 2023