 Type of Data Structure: Today, we will take a deep look at different type of Data Structures.

But before learning about type of Data Structures, let’s see what are Data Structures and why it is so important.

Data Structures is the set of techniques or algorithms used to perform certain tasks on data.

Data Structure helps in organizing the data in a particular by which processing or retrieval of data become much easy and efficient.

In simple words, Data Structure is used to organize, store, process, retrieve and perform many operations on data.

Data Structure is the sole of every software, as the performance of software is majorly depends upon the usage of Data Structure.

So, if you are a Programmer or Software Developer, the good knowledge of Data Structure is mandatory for you.

You can implement Data Structures in any of the top Programming Languages.

Now that you know, what is Data Structure and why it is used. Let’s see the different type of Data Structures with there advantage and disadvantage over each others.

Here are the different type of Data Structures with examples:

## a) Primitive Data Structure​

Primitive Data Structures are the most basic type of Data Structure. These are the Data Structure which are used to build Non-Primitive Data Structures.

With the help of these Data Structures, Non-Primitive Data Structures are defined.

### 1. Int​

Int is a Integer type Data Structure which is used to store Integer type data. For example – int a = 10;

### 2. Char​

Char is a Character type Data Structure which is used to hold Character type data. For example – char c = ‘a’;

### 3. Float​

Float is a floating type Data Structure which is used to hold decimal type data. For example – float f = 12.5;

### 4. Pointers​

Pointer is a Data Structure which hold address of other variables.

It doesn’t hold values but holds address only.

For example – int *a; // a can hold the address of other variable.

## b) Non-Primitive Data Structure​

These are the Data Structures in which we perform all the major operations like – sorting, merging and many more.

We will take an overview of each of the Non-Primitive Data Structure to get the idea of how it works and where to use them.

Non-Primitive Data Structure is comprised of 3 categories, which are Arrays, Files and Lists.

List is also consist of 2 types: Linear List and Non-Linear List or we can say Linear Data Structure and Non-Linear Data Structure.

### 1. Arrays​

Array is a Data Structure which represent the collection of similar kind of data elements.

This means, all the elements in array are of same or homogeneous data type. It can be of Integer type, Character type or Float type.

Array is declared with Data Type Name followed by the Variable Name with its Capacity or Size.

For example – int a will create the array of integer type of size 10.

Similarly to access any element of array, we have to give the Variable Name with the index number of element we want to access.

For Example – a will give us the element of index 5 of array a.

To perform any operation on array, we generally make use of loop. For example, For Loop can be used to print all the values of array.

### 2. Files​​

File is the collection of data or records. It is store in secondary storage devices.

There are number of operations we can perform in File as well.

When the data is large enough, then we use File to store that data in secondary storage device.

### 3. Lists​​

List is the Data Structure which is used to store, retrieve and perform many operation by using Dynamic Memory Allocation.

Unlike Array, we allocate the memory to the element dynamically in list.

There are two type of lists, Linear List and Non-Linear List. Let’s take a look at these Lists.

#### i) Linear Lists​

In Linear Lists, the elements are aligned or organized in sequential manner.

There are 3 types of Linear Lists, which are Linked List, Stack and Queue. Let’s discuss each of them.

Linked List is a linear Data Structure, which consist of many nodes.

Each node is consist of Data Item and a Pointer which contains address to it next node.

A pointer variable in the node is used to point to it next node.

##### 2. Stack​​

Stack is a linear Data Structure, which is similar to array having orderly collection of data elements but unlike array, here we can enter and retrieve data from one end only.

These two operations of entering or retrieving data from Stack is called Push and Pop.

To enter the value in Stack, we perform Push operation and similarly, to retrieve or access the value from stack, we use Pop operation.

Here, important thing to note is that we can perform Push and Pop operation from only one end.

##### 3. Queue​​

Queue is also a linear Data Structure, which is similar to array but here we can enter the value from one end and access the value from the other end only.

The node from which we enter or add the element is called Rear End and its opposite node from which we can access the element is called Front End.

#### ii) Non-Linear Lists​

Non-Linear List is consist of 2 type Data Structure which are Graphs and Trees. Let’s discuss each of them.

##### 1. Tree​

As the name suggest, Tree is a Non-Linear Data Structure which store its elements in the hierarchical manner.

So, it is not required to have elements in tree in a sequence as tree is a Non-Linear Data Structure.

In Tree, there will be one Root Node in top, followed by its Child Node and those Child Nodes can also form as many sub-trees as required.

##### 2. Graph​​

Graph is a Non-Linear Data Structure which is represented as G={V,E}. Here, V represents Vertices and E represents Edges.

In Graph, different Vertices are connected with the help of Edges.

We can assign different weight or cost to different Edges which are connecting the Vertices.

For example – if E1 is the edge connecting V1 and v2, then we can write E1={V1,V2}.

So, this is the complete overview of Data Structures and its type. Basically, Data Structure is consist of these topics only.

We will take a deep dive into all of the Data Structures discussed above with its implementation with code as well.

Hope, you like the article. If you want the regular updates and tips related to Programming and Software Development, right in your Inbox, Subscribe to us by filling the form below and stay connected with us.