Types of Data Structures | Difference Between Linear and Non Linear Data Structures

Types of Data Structures :

Types of Data Structures :

Linear Data Structures :

  1. A data structure is said to be linear if its elements form a sequence or a linear list.
  2. In this type, elements are accessed in sequential order but it is not compulsory to store all elements sequentially.
  3. Linear data structures traverses the data elements sequentially. In linear data structures, only one data elements can directly be reached.
  4. Linear data structure includes array, linked list, stack and queues.

 

Non-linear Data Structures :

 A data structure is said to be non-linear if its elements form a hierarchical classification where, data items appear at various level. In this type of data structure, the elements do not form a sequence.

Trees and Graphs are widely used non-linear data structures.

In non-linear data structures, every data elements may have more than one predecessor as well as successor.

 

Primitive and Non primitive data Structures :

  1. Primitive data structure defines a set of primitive elements which do not involve any other elements as its sub-parts, for example, data structure defined for integers and characters. These are generally primary or builts in data types in programming language.
  2. Non-primitive data structures are those which define a set of derived elements such as array. Array data structures defined in C consists of a set of similar type of elements.. While structure is another example of non-primitive data type while consists of a set of element Which many be of different data types.
  3. Hence, int, char, float and double are primitive data types of language C and array structure and user defined data types are non-primitive data structures.

 

Static Data Structure :

  1. In Static Data structure the size of the structure is fixed. The content of the data structure can be modified but without changing the memory space allocated to it.
  2. A data structure is referred as static data structure if it is created before program execution begins.
  3. The variables of static data structure have user specified names.
  4. Array is static data structure.

 

Dynamic Data Structure :

  1. In Dynamic data structure the size of the structure in not fixed and can be modified during the operations performed on it. Dynamic data structures are designed to facilitate change of data structures in the run time.
  2. A data structure which is created at run time, is called as Dynamic data structure.
  3. Linked lists is a dynamic data structure when realized using dynamic memory management and pointer.
  4. Non-linear data structures are generally implemented in a same way as linked list.
  5. Hence trees and graphs can be implemented as dynamic data structures whereas arrays is a static data structure.

Difference Between Linear and Non Linear Data Structures :

Difference Between Linear and Non Linear Data Structures :

Linear Data Structures

Non-Linear Data Structures

Data elements are arranged in a linear order.

Data elements are attached in hierarchically manner.

Single level is involved.

Multiple levels are involved.

Data items can be traversed in single run

Data items can not be traversed in a single run

These are easy to implement in the computer’s memory.

There are difficult to implements in the computer’s memory.

Memory is not utilized in an efficient way

Memory is utilized in an efficient way.

organized in a way similar to how the computer memory is organized

Organized in a different way then the computer’s memory

Examples : Array, Linked List, Stack and Queue

Example :  Tree, Graph

Types of Data Structures | Difference Between Linear and Non Linear Data Structures Types of Data Structures  | Difference Between Linear and Non Linear Data Structures Reviewed by technical_saurabh on February 12, 2021 Rating: 5

No comments:

Powered by Blogger.