Data Structure & Algorithms
Tags: datastructures, algoritms, python, dsa
Published: 2023-08-15 11:32:56

**What is Data Structure?**
Data Structures are different way of organising data on your computer , that can be used effectively.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pp9tyrlawwsjqeeots92.png)

So if we want to find any specific colour scale we can find that very easily from the right side box.Because it is well organised. 

For software application performance point of view , the efficiency and the performance of the software depends on how the data is stored, organised and grouped together during the program execution. 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/852m16ythn11amtub27t.png)

**What is Algorithm?**
An algorithm is just a set of instruction to perform a task or solve a problem.

Example:
We need a margin in our A4 size paper.So:


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/asrkzrcuwzc3vixiwzsz.png)


1. Choosing the scale from different colour scale
2. Place the scale to my A4 size paper
3. use a pencil or pen and draw the margin

Moreover, Algorithms in our daily life:

To drink a coffee:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x848949mh72e03ad8yjd.png)


1.go to Coffee Shop
2.pay money
3.take coffee

This set of steps referees to algorithms.

Algorithms in computer science: 
Set of rules for a computer program to accomplish a task.


**What makes a good algorithm?**
1. Correctness
2. Efficiency

As a software or a computer, our responsibility is to perform operation on the data.First we give some input, then we process it and then we give back processed data as output.Input of data can be in any form. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n7f27ysbtjltke7w7m03.png)


Example: Google Map

Input(Starting and ending) --> Process(DSA) --> Output(Shortest Path)

Other Example: Library (Well Organised)

Think , if I need algorithms book I first go to computer science section, then Algorithms section.I will able to find my desired book.Because it is well organised Which referrers to Data Structure.

**Types of Data Structures**

In python, we can devide in 2 sections:

-  Primitive
-  Non Primitive

_Primitive:_

1. basic data types that can not be broken into simpler data type.
2. fixed size and usually smaller in size than non primitive.
3. used for simple operation.
4. represented in memory as a simple values.

_Non Primitive:_

1.  more complex and can be broken down into smaller data types.
2.  can be large in size and grow or shrink dynamically. 
3.  used for complex operations such as data manipulation,sorting and searching.
4. represented in memory as pointers to other memory locations.

Topic in Data Structure:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/armftwz5l2ck1twckegu.png)



These are the data structures we have.There are more but these are the most important one.

- **Linear data** structures are used to represent a sequence of data where the order of elements are important.

- **Non Linear's** are not represented sequentially.Its used to represent a hierarchical relationship between data elements where each element is connected to one or more other elements in a specific way.

**Some types of Algorithms**:

- Sorting (to sort data in assending or desending order)
- Searching (to find specific value in a data set)
- Graph (to work with data that can be represented as a graph)
- Recursive
- Devide and Conquer

and Many more...