# Computer Programming : Classification or Type of Data structures, C Programming

Data structures can be classified, keeping in view the way the elements are connected to each other, the way when they are stored in memory or the way further division of a data structure.

#### Linear and Non-Linear

This type of classification is on the basis of element's connection and placement. When the elements of a data structures are placed in order, means if the second element is placed after the first one, third one after the second one and so on, are called**Data Structures otherwise**

*Linear***Data Structures. Examples of Non-linear Data Structures: Trees, Graphs etc.**

*Non-Linear*ARRAY is an ordered collection of similar data elements. So, it is called as Linear Data Structure. The element are arranged in Linear order i.e. one after the other at consecutive memory locations.Similarly LINKED LIST is also a Linear Data Structure Where the elements of List are stored in Linear Order but at different memory locations, the Linear order is maintained by one of the fields of Linked List, called Link field(pointer to next node element).

On the other hand, TREE is a non-linear data structure in which the elements are stored in hierarchical order instead of linear order. In hierarchical order top most node is called root node and it may be connected to zero, one or more than one nodes. So from one element elements of the data structure are placed such that they are adjacent (connected) to more than one element, then the resulting data structure, Which is non-linear one, is called as GRAPH. Graph is a general non-linear data structure and Tree is a restricted Graph.

STACK and QUEUE are specialized data structures where insertion and deletion are restricted. STACK and QUEUE can be implemented either using one-dimensional array or linked list.

Linear data structure are also called as

**data structures and non-linear data structures are called as**

*contiguous***data structure.**

*non-contiguous*#### Static and Dynamic

This type of classification is on the basis of Memory Allocation. The data structure modeled must be present in memory to use it i.e. memory should be allocated to the data structure to store the data in it. If the memory is allocated to the data structures at the time of compilation of programs where the data structures are used, then such type of data structures are called as

**data structures.***static**Compilation of program is translation of source program into an object program. The linear data structure ARRAY is static data structure for which memory is allocated at the time of compilation.*On the other hand if the memory is allocated at the time of execution of program (While running) for the data structures used in the program are called

**data structures. The linear data structure LINKED LIST is a dynamic data structure for which memory is allocated at the time of execution, means the memory for data structure is allocated as per the user wish at the time of executing the program.**

*Dynamic*#### Primitive and Non-Primitive

This type of classification is on the basis of further division. If the data structure is not further divisible to another data structure, then it is called as

For example the standard data types of C like char, int, float are fall under the category of Primitive data structures where as user defined or derived data types like array, structure are further divisible so they are called Non-Primitive data structure.

**data structure and if it is further divisible then it is called as***Primitive***data structure.***Non-Primitive*For example the standard data types of C like char, int, float are fall under the category of Primitive data structures where as user defined or derived data types like array, structure are further divisible so they are called Non-Primitive data structure.

## 0 comments: