In this tutorial, we will start with an introduction to data structure why data structure is used and data structures different types so let’s begin with the topic.
As a name Data Structure implies the data means information of any kind and the structure means arrangement, that is an arrangement of data.
Definition of Data Structure
- Unsequenced sentences or information can be arranged in a particular format is known as a data structure.
- The definition of Data structure of states that on the data we have it is stored in a particular format
Why data structure used?
- Using data structure we can access the information stored on disk very efficiently.
- As a data stored in a particular (efficient way), it is easy to access data as well as for processing the data.
- It is a secure way to store the data.
- It provides better management of data.
Now we know what is a data structure and why it is used now we will see the different type of data structures.
Types of data structure
As a data structure arranges the data in a particular format there are many data structure to implement that.
Linear data structure
In this type of data structure, the data is traversed in a sequential way, That is we can access only one element.
Example: Array, Linked list, Stack, Queue.
- An array is a Linear type of data structure.
- As it is a linear it’s a sequential access as well.
- The arrangement of data in an array is in systematic order.
Example: int array;
- The stack is also a Linear type of data structure.
- It works on LIFO(Last In First Out) Manner.
- The queue is also Linear type of data structure.
- It works on FIFO(First In First Out) Manner.
Example: Ticket Counter
4. Linked list:
- It is also a linear type of data structure.
- Data is stored as a node with the address of the next node.
Non linear data structure
In this data structure, the data is stored in an unsequential order and can also retrieve (access) from anywhere.
The tree is a set of a node which has a starting node called as a root node and all other connected with that node to form a tree.
The graph is a set of a node connected with edges.