top of page

Subscribe my newsletter for engineering insights, news, and developments @ The Engineering ApeX 

Prepping for DSA: Key Things to Know Before Starting with Data Structures & Algorithms

Imagine the incredible impact of writing optimized code that can save organizations millions of dollars in computational costs. This concept is fascinating, whether you're a tech enthusiast or not. It's all made possible by one of the most powerful concepts in modern computer science: Data Structures and Algorithms (DSA).

For any organization, the customer experience is of utmost importance. No organization can afford to compromise on user experience, as it directly affects their survival in the market. As a software developer, our goal is not merely to change 5 + 2 to 7, but to optimize it by reducing complexity. The speed and accuracy of the output are key parameters that significantly contribute to the best user experience and must be maintained.

Imagine using your favorite Instagram, but it takes a frustrating 10 seconds just to like a single post. Not a great experience, right?

When it comes to maintenance, organizations have two options: investing more and more in infrastructure (resources) or leveraging the skills of developers in applying DSA. While applying DSA may not necessarily decrease infrastructure investment (as it depends on various parameters), it does save a significant amount of costs.

Let's delve into DSA.

When faced with a problem, we follow solutions in the form of an algorithm. An algorithm consists of steps that need to be followed sequentially. Suppose we have an idea to create an Instagram-like post feature. We have the product and its associated code, which is stored on the hard disk. When we run or execute the program, it loads into the main memory (RAM). The instructions (algorithm) we've written in our code are then executed by the CPU.

We can visualize it this way:

Idea > Software > Code > Hard Disk > RAM > CPU

We had the idea for the Instagram post-like feature, wrote the code, stored it in a folder on the hard disk, and upon execution, it loaded into RAM. The CPU then performed all the specified operations/steps.

So why does our Instagram post-like feature code take 10 seconds to like a single post? The reason is that the code we wrote, or someone else wrote, is not optimized, even though it functions (initially, the running aspect is the primary metric for any code).

As developers and engineers gain experience, they learn about code quality. I would not enjoy using the Instagram app if it took 10 seconds just to like a single post. It would be a poor user experience.

However, there can be another optimized snippet of code that achieves the same goal (liking a post) but performs much better than the one we initially wrote, which takes 10 critical seconds. It's all about how data is structured, and this is where DSA comes into play.

Building on the example I mentioned in one of my previous LinkedIn posts:

If the "Add to Cart" button or feature takes 10 critical seconds to function and proceed to the next step, as a regular customer of Amazon, I would stop using it and potentially switch to another eCommerce platform like Flipkart.

Consider this: if my average purchase on Amazon is $20 and a million users are facing the same issue with the "Add to Cart" feature, many of us would likely abandon the platform, resulting in a significant loss of $20 million for Amazon.

The point here is not to calculate the precise financial impact on Amazon or other eCommerce platforms. Rather, it emphasizes the crucial importance of building highly efficient applications that can serve customers with speed and accurate output.

In conclusion, mastering DSA is a key aspect for software developers and engineers. It enables us to optimize code, provide exceptional user experiences, and save organizations substantial costs.

bottom of page