The Foundation
Everything in programming from the simplest of applications to the software used by mega corporations is built on the foundation of data, the structure of and relationships between data, and algorithms that manipulate data.
So what exactly is DSA?
Data Structures and Algorithms, as you would imagine involves two things, namely:
-
Data Structures are devices used to organize data stored in the system’s memory. A data structure determines the order of the stored data and what kinds of relationships can exist between the data it contains. You can think of it like having a closet with hangers, and a bag. Both can be used to store your clothes, but in different ways. Each with its caveats.
Every data structure has its strengths and weaknesses, as such, picking the right data structure might just determine how fast your app loads, how smoothly your game runs, and whether your website can handle thousands of users without crashing.
The most common data structures include arrays, linked lists, trees, hash tables, and graphs.
-
Algorithms are step-by-step instructions for a task, like a recipe for a meal. This is what tells your computer exactly how to sort a million records, find the shortest path between two cities, or compress a video file without losing quality.
The most common algorithms include sorting algorithms like quick sort and merge sort, searching algorithms like binary search and tree search, etc.
Using the wrong algorithm can have you waiting a long time for a task that could be completed in the blink of an eye.
DSA in Your World
Let me paint you a picture of how DSA impacts the software you use every day:
When you search for a song on Spotify, the app doesn’t scan through millions of tracks one by one. It uses sophisticated tree structures and search algorithms to find your favorite tune in milliseconds. When Google Maps calculates the fastest route to your destination, it’s running graph algorithms on a massive network of roads, considering traffic patterns and road conditions in real-time.
That smooth scrolling through your Instagram feed? It’s powered by efficient memory management and data structures that prefetch and cache images. The autocomplete suggestions as you type in your search bar? Hash tables and tree structures working behind the scenes to predict what you’re thinking.
Even the simplest of operations have data structures and algorithms working in the background to ensure that you get exactly what you’re out to find and nothing less.
Why Learn DSA in C?
Data Structures and Algorithms is something you can learn in whatever programming language you choose be it Go, Rust, Python, or Scala as these are core concepts that exist everywhere. But while some languages like Python and JavaScript abstract a lot of the more ‘interesting’ things - which can be great as it allows you to focus more on the problem at hand, these abstractions mean that you’re slightly detached from the core processes. Learning DSA in C is like learning to drive with a manual transmission - it forces you to understand the underlying process - which leads to a deeper understanding of core concepts. This automatically gives you a status buff in whatever programming language you move on to.
