Is it necessary to know algorithms to become a good programmer?
Many developers will tell you that algorithms and data structures are required if you only want to build advanced stuff.
While this is true for advanced algorithms, like those asked by FAANG at interviews, I never met a good programmer who isn’t good with basic algorithms and problem-solving.
I’ll give you some concrete examples to showcase that even Front-End developers need to know basic algorithms and problem-solving.
On the landing page of AlgoCademy.com, we have a carousel that shows the first three testimonials.
The carousel shifts one item to the left when you click the right arrow, showing the 2nd, 3rd, and 4th testimonials.
The widget initially worked by showing the 4th, 5th, and 6th items instead.
Given the array containing the testimonial objects, I had to build the carousel by putting the first three testimonials in one group, 2nd, 3rd, 4th in another group, 3rd, 4th, 5th in another, etc.
It’s a simple algorithm, but if you’re not good at these, would you be able to solve it, considering you can’t find a solution online?
Let’s see another example:
We have a search feature on the platform.
I tried a few JS libraries, but all of them didn’t consider misspelling words.
It worked well only for multiple word titles as long as you correctly misspelled most words.
I wanted something to work for misspelled words, so I built something from scratch.
Imagine this was a task given to you at your job.
You may find some libraries, but they aren’t working as the product owner expects.
Maybe you find backend solutions that do this, but the latency for API requests is too high.
What would you do in this case? Hire someone on Fiverr to do your task?
The last example is the core feature of AlgoCademy that makes learning to code so much easier: the interactive coding tutorial.
I’ve spent a few months perfecting the algorithm behind it.
Some great engineers told us that they have thought for a few days and still have no idea how we made it work.
Even if you’re doing front-end development, you still need to handle data, do some processing, and make the UI as fluid as possible.
When you’re manipulating the DOM, that’s basic tree knowledge.
For backend development, you usually use some technologies that use algorithms, and knowing how that works internally makes you good at making decisions that make the app scale (e.g., Database indexes).
Also, think of any innovative technology you use:
Google search uses inverted document indexing for instant search, meet in the middle algorithms for autocorrect, and graphs to store, analyze and grade the quality of the websites.
Google Maps use shortest path algorithms and quad or kd trees for proximity search.
Keyboard Autocorrect and Swipe Typing use Ternary Search Trees.
Facebook uses graphs to store and analyze connections.
Amazon, Spotify, and Youtube use recommendation algorithms.
And the list goes on.
Can you get by without algorithms?
Sure, but you won’t work on anything exciting or in teams where you can grow and improve by learning from your colleagues.
One final food for thought:
Every program you write, by definition, is an algorithm.