What is a Data Structure ?
Difference between linear and non-linear.
The data structure is a storage that is used to store and organize data. It is a way to arranging data on a computer so that it can be accessed and updated efficiently. Like if you want to store data sequentially then you can go with the array data structure.
The data structure is a key component of Computer Science and is largely used in the areas of Artificial Intelligence, operating systems, graphics, etc.
Remember one thing, Data structure, and data types are different things, data structure is the collection of data types arranged in a specific order.
The data structure is divided into two parts:
- Linear Data structure
- Non-Linear Data structure

Let’s have brief info about them.
Linear Data Structure
In LDS the elements are arranged in the sequence one after the other. Since elements are arranged in a particular order they are easy to implement.
But as the complexity of the program increases, LDS will not prove to be a good choice.
1. Array: Elements in an array are arranged in a continuous manner. All the elements of an array are of the same type. And the type of element that can be stored in the form of an array is determined by programming language.
2. Stack: In stack, elements are stored in the “LIFO” principle {Last In First Out}. That is the last element stored in a stack that will be removed first.
3. Queue: it works on the “ FIFO” principle{ First In First Out}, it just works like a queue of people in the ticket counter.
4. Linked data Structure: Elements are connected through a series of nodes, and each node contains the data item and address to the next node.

Non-Linear Data Structure
Elements are arranged in a hierarchical manner where one element will be connected to one or more elements.
1. Graph Data Structure:
Each node is called vertex and each vertex is connected to other vertices through edges.
Popular graph based Data Structure.

1. Spanning tree and minium spanning tree
2. Strongly connected components
3. Adjacency matrix
4. Adjacency list
2. Tree Data Structure:
Tree is also collection of vertices of edges. However, in tree data structure, there can only be one edge between 2 vertices.
Popular Tree based Data Structure.

1. Binary tree
2. Binary search tree
3. Avl treeee
4. B-tree
5. B+tree
6. Red black tree
Now pack all things together and have a clear difference between them.

Thank you ^_~.