To be honest, I’m not a big fan of algorithms, DSA, theory of computation, and all those things. The reason is simple.
- Algorithms didn’t help me get an opportunity (but now, somewhere, they’re helping me).
- My first impression of learning algorithms (from the hell-boring professor at my college).
- My perspective was that AI’s gonna code, and we’re gonna instruct it to make things optimal. For review purposes, we can search and learn, so why should I bother learning all this?
And, I asked so many professionals in my network, including software engineers and technical recruiters (from both startups and MNCs). Each and everyone had a different perspective. Some people said,
“Ohh, DSA matters for us, most of our technical rounds rely on that, people should be aware of problem-solving.”
And another set of people said,
“We want people who understand programming fundamentals and think with a real product mindset, with exposure to problem-solving skills.”
For some people, DSA helped them get opportunities, and some people got opportunities by showcasing their work. They’re just manifesting what worked for them, simple :)
Here, both sets of people claim this word “problem-solving”. Someone says solving problems with data structures, someone else says solving problems with real product exposure.
Problem solving?
This is one of the “finest” and most repetitive words in my mind for the last three months, just job-search things.. (90% of JDs have this word). Two different perspectives, as I mentioned earlier.
But according to me:
“Problem-solving is another daemon of your general thinking.”
Your vision, dimensions, thinking and approach will change once you enter into it. Things start looking completely different to you, even when they look normal to others. Where you find something interesting, painful, or something that could be more optimal, that’s where you start to care. Day by day, we’re all problem solvers.. but in terms of computers, they have more problems than us.
Just think about this.
Algorithm?
This was my favourite word when I was in my second year of college, where people used to pronounce this word in different sounds and slangs. Anyways, I love this word because the staff who taught us this was my favourite staff (I’ll tell that story later ).
To me, an algorithm is:
“Procedure to build something without bricks..”
Sounds not clear? Lemme explain..
So, we’ve all coded at least once in our lives, right? While coding, we come across lots of modules, packages, pre-built functions, keywords, headers, and all those things.
So, they’re like bricks. Using these bricks, we’re building our solutions, literally using building blocks to create something. Just think, how was that brick made or created in the first place? That’s where algorithms come into play. It’s sort of a huge fundamental concept that makes the 0-to-1 state possible. From that 1, we’re building blocks on top of it.
Here, you want to be the one who makes the bricks.
Let’s Realize..
So, let’s take a quick example. We’re writing code to convert 12-hour time into 24-hour time (just remembering the railway time format). How will we do it? (I’m a pythonista, so I give example in python)
Simple, just use the datetime module, convert it, simple:
from datetime import datetime
s = "07:05:55PM"
time = datetime.strptime(s, "%I:%M:%S%p")
result = time.strftime("%H:%M:%S")
print(result)pyNow, what if you don’t have the datetime module? Just think about how programmers would do this without relying on that module. That's also simple:
def timeConversion(s):
hour = int(s[:2])
period = s[-2:]
if period == "AM":
if hour == 12:
hour = 0
else:
if hour != 12:
hour += 12
return f"{hour:02d}{s[2:-2]}"
print(timeConversion("07:05:45PM"))
print(timeConversion("12:00:00AM"))
print(timeConversion("12:00:00PM"))See this code, how does the thinking actually work here? We’re slicing the string, extracting the hours and periods, then making a condition with respect to the period and hour, and finally adjusting the hours to convert it into 24-hour format. Simple. Your thinking..
Not only this, even if you take sorting an array, we can simply use arr.sort() or sorted(). Simple, right? But did you ever think about how these functions were built or written, and which sorting algorithm they use?
So, here’s the thing, algorithms become crazy interesting when you start thinking about things deeper. At some point, they make you think like a computer, not just like a user.
What Made Me Write This?
Well, I want to thank YouTube, where I was looking and searching for some good content, and I came across a video by Chrome for Developers, “What’s new in JavaScript” (an 8-year-old video) from HTTP 203, featuring Sathya Gunasekaran and Mathias Bynens. If you have time, check this out.
They started discussing things like classes, private class features, property assignments and property declarations. Literally, at first, it sounded like some theoretical textbook stuff. But at that moment, I started thinking that we need the capability to think in a programmatic approach. At the end of the day, even the V8 engine was built around these concepts, right?
Later, I watched some videos of Sathya, where he was giving talks at several React conferences and Google I/O (where he talked about Babel), React compilers, abstract syntax trees, prop distributions, memoization, and state properties. At first, these sounded like completely new terms, but you can actually find all these concepts in a small set of code and a basic file structure.
Thanks to YouTube for this suggestion, you made me understand algorithms a little better!
TL;DR;
I’m not here to tell you, go and study algorithms. It’s your wish. If you really care about depth and want to know how machines process your code, how specific frameworks and pre-built functions work, go and study algorithms.
“Don’t learn data structures and algorithms just to get a job, learn them to fit into the world of computation.”
That might eventually help you get a job, or even something much better than just a good opportunity.
Why not? In the future, you might write an algorithm that gets studied by others or even the next generation.
And, still, it’s the AI era. AI is coding super well, I agree. But we need enough foundation to understand what it’s doing. Once you have that foundation, just dive into learning algorithms. Let AI code, you’ll learn, understand, review and guide it better.