Introduction
Data structure is a logical way of organizing the data in computer's memory .
There are main two types of data structures : Linear and Non-Linear .
In linear data structure the data is organized in linear manner , i.e. one element after other. While in non-linear data structure elements are organized in hierarchical manner .
What do you mean by hierarchical manner ? To understand it better, let's consider an example. Have you seen family tree ? How it is represented ? There is single ancestor ,then his children and so on . There are levels ,we call it as generation. One person can have either one child or multiple children. This example certainly clarifies the idea of non-linear data structure .
Linear data structure is simple and easy to implement as compared to non-linear one .
There are some important points of difference between Linear and Non-Linear data structure . Let's through light on what is the exact difference :
There are main two types of data structures : Linear and Non-Linear .
In linear data structure the data is organized in linear manner , i.e. one element after other. While in non-linear data structure elements are organized in hierarchical manner .
What do you mean by hierarchical manner ? To understand it better, let's consider an example. Have you seen family tree ? How it is represented ? There is single ancestor ,then his children and so on . There are levels ,we call it as generation. One person can have either one child or multiple children. This example certainly clarifies the idea of non-linear data structure .
Linear data structure is simple and easy to implement as compared to non-linear one .
There are some important points of difference between Linear and Non-Linear data structure . Let's through light on what is the exact difference :
Linear Data Structure | Non- Linear Data Structure |
---|---|
The data elements are stored in sequential manner . | The data elements are not stored in sequential manner . |
One data element is stored after the another linearly . | In non-linear ,data elements are stored in hierarchical manner. |
The traversal of data elements is very easy in linear data structure. | The traversal of data elements is not so easy in non-linear data structure. |
Suppose you want to visit a particular data element in linear data structure , you need to traverse all the elements present before that element . | In non-linear data structure , if you have visit a particular data element , there is no need to traverse all the nodes /data elements present in structure . |
In linear data structure ,there is one to one relation between data elements. | In non - linear data structure ,there may be one to one or one to many relation between data elements. |
One data element can be connected to maximum two other data elements only . | One data element can be connected to several other data elements . |
Linear data structure is very easy to implement . | Non-linear data structure is relatively complex to implement . |
Linear data structure has single level of data elements . | Non-linear data structure involves multiple levels of data elements . |
Array , Stack ,Queue , Linked list are the examples of linear data structure. | Tree and Graph are the examples of non-linear data structure. |
Just a second !
Hey , Did you find this article useful ? If yes , share with your colleague and give him/her opportunity to learn and grow . Knowledge is free on Internet !
0 Comments