Data Structures and Algorithms (DSA) are to programming what systematic rules, theorems and geometric constructs are to mathematics. If a programmer knows DSA, like a math or physics student knows his rules and geometry, he is effectively armed to confront and vanquish problems.
A programmer writing code without knowledge of DSA can certainly solve problems but the process tends to be a mirror image of a calculus student trying different algebraic rules to unlock the solution. Trial and error, frequent deadends, hesitant solutions. We’ve all been there.
Lately I’ve been feeling like I’m back in my first semester in Calculus more often than not in my timed coding challenges for interviews. I suspect there are others who feel like that too and maybe my strategy for dealing with it and mastering DSA will be helpful to us all.
Confidence from Knowledge
I remember when I took Calculus 1 in my first semester in college. I was somewhat intimidated by the new terms but was comforted by their foundation in more familiar geometric concepts. As time went on, I found that it wasn’t nearly as difficult as I thought it was. Every problem was simply a matter of knowing certain rules and invoking them on the given function or summation.
These rules were a bit tricky to remember and I got a B in Calc 1, but I mastered them in Calc 2 and got an A. I ended up completing every single math course required for a bachelor’s degree in Physics at Drexel University with an A or better. Mathematical physics was the most challenging course, because the rules started to involve more advanced and larger sets of equations, but the fundamental strategy was the same as Calc 1.
Having these rules fresh in my mind and available to me whenever I was solving a math problem gave me confidence. Oftentimes, I skipped on double-checking my solution because of the process of arriving to it was so clean, smooth, and elegant. When the rules are correctly applied, the right solution is inevitable. I’m sure you know exactly what I’m talking about.
Confidence comes from a firm foundation of knowledge.
When I talk about my successful projects listed on my resume, I am confident because I know the details of those projects, their challenges and how I overcame them.
However, this ‘project-based’ confidence in a timed coding challenge is like bringing a knife to a gunfight. If I don’t have a firm command of DSA, it will show. While my analysis strategy and critical thinking skills can reassure the hiring manager that I can eventually solve the problem, I just don’t feel comfortable not knowing what I’m supposed to.
This is why I’m starting a new series of blog posts which I’ll use to document my journey to mastering DSA, refreshing what I knew back in my college courses while learning new things I didn’t know before.
The topics to be covered are a mix of data structures and algorithms:
- Linked Lists
- Graphs and Trees
- Dynamic Programming
When covering any topic, like Arrays, I’ll create a single page that will evolve over time, almost like a documentation page.
I plan to review everything from the ground up, or first-principles as Elon Musk famously applies it to his problems. Then do coding challenges related to that structure, solving them in various languages (Python, Go, F# and Scala).
I’ll include a section of how the DSA is handled using functional programming because that’s what I’ve always been curious about and want to learn myself.
Once all this information is covered, I’ll host it on my site as a separate section entirely so that it’s super easy to find.
The ‘struggle’ we experience in a programming challenge is feedback. It’s telling us we need to study this stuff, and study it well because we’re taking on a big responsibility when we’re coding professionally. Businesses rely on our ability to build mental models and work out their software problems.
It is only fair that we work from a solid foundation of real knowledge and experience.
Our excitement to learn must always exceed the frustration of failing at a problem so that we’ll come back the next day and grow again.
Everyone should experience the joy of doing things well.
Just building a study habit is all we need to master any topic, no matter how challenging.
I feel like sharing my journey here will be the best way to keep myself on-course while helping others. So that’s what I’ll do!