Intro
As a programmer you must have heard about the term Data Structures & Algorithms or simply DSA, or of you are a new bee someone must have told you practice DSA in the beginning, or often you have heard that most of the big tech companies like Meta, Amazon, Apple, Netflix, Google (collectively known as MAANG) wants to see DSA in your resume. In this article I am going to break down everything, and I am pretty sure after reading this article all your concepts and doubts regarding DSA will be cleared.
Data Structures
Look at the heading, you will understand the meaning, all I want to say is that Data Structures is basically structuring your data in the best possible way. Let's understand this with an example. Suppose you are building an Internet Company like Facebook or Twitter, so you will have to work with user data. Now as an entrepreneur you will have to organize your user data in such a way that it should be cost effective and accessing the data should consume less time to deliver a great user experience, also you have to choose the right Data Structure as per your needs.
Types of Data Structures
There are two types of data structures linear and nonlinear , now lets understand both of them in the most easiest way..
Linear Data Structures
When the elements in a data structure are arranged in a sequential order i.e. one by one , then we refer it as a linear data structure . Just like number of people standing out side an ATM, or a roll number of students written sequentially in an attendance register. In programming we have four types of linear data structures they are :
- Array Data Structure
- Stack Data Structure
- Queue Data Structure
- Linked List Data Structure
Non-Linear Data Structures
When the elements in a data structure are arranged in a hierarchical order they we refer it as a non- linear data structure. Like a tree with many branches or categorizing people according to their marks or a family tree , where say your grand father is the top them comes your parents, uncles and aunts and then you. in programming we have two types of data structures they are :
- Graph Data Structures
- Tree Data Structures
Linear | Array | Stacks | Queues | Linked - Lists | |
Non- Linear | Graphs | Trees |
Algorithms
Just think about your daily life, before doing any task we follow some steps, similarly in programming before writing the code we first write down the steps or simply an algorithm is the set of instructions to solve a particular problem. Let's understand this with a real world example, like every day when I wake up the first thing I do is to brush my teeth so here the problem is brushing my teeth and the algorithm will be wake up then put away my right leg 30 cm away and then same with my left leg then I will repeat this until I reach to my brush then I will simple grab my brush and will start brushing my teeth .. Just like that In programming we need algorithms before we write any code like the algorithm for printing a simple helloworld
will be
- start
- print hello world
- stop
Conclusion
This was all about the concept of data structures and algorithms, wait is this knowledge enough ? absolutely no . This is just the first part of the series Data Structures and algorithms and a lot more to come where I will explain each topic in a single blog. Lastly, if you love this article feel free to share it with your friends and peers .. Stay tuned for the next