Data may contain a single element or sometimes it may be a set of elements. Whether it is a single element or multiple elements but it must be organized in a particular way in the computer memory system. In this article, we are going to discuss some very important terms like what is data structure & classification of data structure – Primitive Data Structure, Non-Primitive Data Structure etc.

## What is data structure :

The data structure is basically a technique of organizing and storing of different types of data items in computer memory. It is considered as not only the storing of data elements but also the maintaining of the logical relationship existing between individual data elements.

The Data structure can also be defined as a mathematical or logical model, which relates to a particular organization of different data elements.

## Specification of data structure :

- Organization of data
- Accessing methods
- Degree of associativity
- Processing alternatives for information

Data structures are considered as the main building blocks of a computer program. So, at the time of selection of data structure, we should follow these two things so that our selection is efficient enough to solve our problem.

- The data structure must be powerful enough to handle the different relationship existing between the data.
- The structure of data also to be simple, so that we can efficiently process data when required.

Basically, the term data structure and algorithm both are somehow related to each other. Set of a well-defined algorithm and data structure makes a computer program efficient.

Algorithm + Data Structure = Program

A program can be made using the different data structure to produce the same output. But the efficiency of the program will depend on the choice of the best data structure to create that particular program. We have a classification of data structures to choose to make this happen.

## Classification of data structure :

The classification of data structure mainly consists of :

- Primitive data structure
- Non-primitive data structure

## Primitive data structure :

The primitive data structures are known as basic data structures. These data structures are directly operated upon by the machine instructions. Normally, primitive data structures have different representation on different computers.

## Example of primitive data structure :

- Integer
- Float
- Character
- Pointer

## Non-Primitive data structure :

The non-primitive data structures are highly developed complex data structures. Basically, these are developed from the primitive data structure. The non-primitive data structure is responsible for organizing the group of homogeneous and heterogeneous data elements.

## Example of Non-primitive data structure :

- Arrays
- Lists
- Files

## Integer :

The integers are signed or unsigned whole numbers with the specified range such as 5, 39, -1917, 0 etc. They have no fractional parts. Integers can be positive or negative but whether or not they can have negative values, it depends upon the integer types.

## Float :

Float refers floating point or real number. It can hold a real number or a number having a fractional part like 3.112 or 588.001 etc. The decimal point signals that it is a floating point number, not an integer. The number 15 is an integer but 15.0 is a floating point number.

## Character :

It can store any member of the basic character set. If a character from this set is stored in a character variable, its value is equivalent to the integer code of that character basically known as ASCII code. It can hold one letter/symbol like a, B, d etc. Characters can also be of different types.

## Pointer :

A pointer is but a variable-like name points or represents a storage location in memory (RAM). RAM contains many cells to store values. Each cell in memory is 1 byte and has a unique address to identify it. The memory address is always an unsigned integer.

## Arrays :

Arrays are the set of homogeneous data elements stored in RAM. So, they can hold only one type of data. The data may be all integers, all floating numbers or all characters. Values in an array are identified using array name with subscripts. Single sub-scripted variables are known as a one-dimensional array or linear array; two sub-scripted variables are referred as a two-dimensional array.

## Lists :

A list is a collection of a variable number of data items. Lists fall in the non-primitive type of data structure in the classification of data structure. Every element on a list contains at least two fields, one is used to store data and the other one is used for storing the address of next element.

## Files :

Files contain data or information, stored permanently in the secondary storage device such as Hard Disk and Floppy Disk. It is useful when we have to store and process a large amount of data. A file stored in a storage device is always identified using a file name like HELLO**.****DAT** or TEXTNAME.TXT and so on. A file name normally contains a primary and a secondary name which is separated by a **dot(.)**.

## Stack :

Like arrays, a stack is also defined as an ordered collection of elements. A stack is a non-primitive linear data structure having a special feature that we can delete and insert elements from only one end, referred as TOP of the stack. The stack is also known as Last In First Out (LIFO) type of data structure for this behaviour.

When we perform insertion or deletion operation on a stack, its base remains unchanged but the top of the stack changes. Insertion in a stack is called Push and deletion of elements from the stack is known as Pop.

## We can implement a stack using 2 ways:

- Static implementation (using arrays)
- Dynamic implementation (using pointers)

## Queues :

Queues are also non-primitive linear data structure. But unlike stacks, queues are the First In First Out (FIFO) type of data structures. We can insert an element in a queue from the REAR end but we have to remove an element from the only FRONT end.

## We can also implement queues using 2 ways :

- Using arrays
- Using pointers

## Trees :

Trees fall into the category of non-primitive non-linear data structures in the classification of data structure. They contain a finite set of data items referred as nodes. We can represent a hierarchical relationship between the data elements using trees.

## A Tree has the following characteristics :

- The top item in a hierarchy of a tree is referred as the root of the tree.
- The remaining data elements are partitioned into a number of mutually exclusive subsets and they itself a tree and are known as the subtree.
- Unlike natural trees, trees in the data structure always grow in length towards the bottom.

## Graph :

Graph falls in the non-primitive non-linear type of data structure in the classification of data structure. Graphs are capable of representing different types of physical structures. Apart from computer science, they are used broadly in the fields of Geography, Chemistry & Engineering Sciences.

A graph normally a combination of the set of vertices V and set of edges E.

## The different types of Graphs are :

- Directed Graph
- Non-directed Graph
- Connected Graph
- Non-connected Graph
- Simple Graph
- Multi-Graph

**Liked this article? Then please like our Facebook Page & stay connected with us.**

**Also Read: Time & Space complexity of an algorithm.**

## MMK

25 Nov 2018Very useful information is provided about introduction to data structures.The notes are clear and easy to understand .Thanks for uploading this useful stuff thank you very much