The Truth About Algorithms and Data Structures
David Amos
Posted on September 23, 2022
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.
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.
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.
Here are some of my favorite books on algorithms and data structures:
For the curious beginner:
- Grokking Algorithms by Aditya Bhargava
- The Recursive Book of Recursion by Al Sweigart
For folks who want to dig deeper:
- Advanced Algorithms and Data Structures by Marcello La Rocca
- A Programmer's Guide to Computer Science, Vol. 1 by Dr. William Springer
- A Programmer's Guide to Computer Science, Vol. 2 by Dr. William Springer
For folks who want all the details:
- Introduction to Algorithms, 3rd Edition by Thomas Cormen, et al
Become a better coder in 5 minutes.
One email, every Saturday, with one actionable tip. Always less than 5 minutes of your time.
Posted on September 23, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.