Home »
Data Structure

# Data Structure types and operations associated with them

Learn: In this article we are going to learn about **different data types**, **primitive and non-primitive data structures**. Operations associated with data structures. What are four basic data structure? And why these data structure required.

Submitted by Amit Shukla, on September 28, 2017

## Data Structure

**Data structure** is representation of the logical relationship existing between individual elements of data. In other words, a data structure is a way of organizing all data items that considers not only the element stored but also their relationship to each other We can also define it as mathematical or logical model of particular organization of data items.

**Data structure mainly specifies the following things:**

**Organization of Data**
**Accessing methods**
**Degree of associativity**
**Processing alternatives for information**

Data structures are the building blocks of a program. The selection of a particular structure focusses on the following two things:

- The data structure must be rich enough in structure to reflect the relationship existing between the data.
- The structure should be simple to process data effectively whenever required.

**Data Structure can be classified in to two broad categories:**

**Primitive data structure**
**Non primitive data structure**

### 1) Primitive Data Structure

Primitive data structure are basic structures and are directly operated upon by machine instructions. Primitive data structure has different representation on the different computers. Primitive data structure is divided in to four categories:

- Integer
- Floating point numbers
- Character constants
- Pointers

### 2) Non primitive data structure

Non primitive data structure are more sophisticated data structures. Non primitive data structure are derived from the primitive data structures. The non-primitive data structures emphasize on structuring of a group of homogeneous (same type) or heterogeneous (different type)data items.

Non primitive data structure are categorized into following:

- Array
- Linked list
- Queue
- Tree
- Graph
- Stack

**1. Array**

An array is the data type of non-primitive type. It is defined as set of number of same type of elements or we can say set of homogeneous elements or data items. It means an array can contain one type of data only, either all floating point numbers, or all characters. Declaration of array is a follow:

int A[10];

Where int specifies the data type of elements array stores. a is the name of array, and the number specified inside the square brackets (subscript) is the number of elements an array can store, this is also called **size** and **length** of the array.

**2. Linked list**

A linked list can be defined as a collection of variables number of data items. Lists are the most commonly used non primitive data structures. An element of linked list is consisting of two parts. One part is use to contain the value or parameter. While the other part is used to store the address of next element of the linked list.

**3. Queue**

Queue are first in first out type of data structure. In a queue new elements are added to the queue from one end called REAR. And element removed from the other end called FRONT.

**4. Tree**

A tree can be defined as finite set of data items called nodes. Tree is a nonlinear type of data structure in which data items are arranged in a sorted sequence. Trees represent the hierarchical relationship between various elements. The tree always grown in length towards bottom in data structure.

**5. Graph**

A graph G (V, E) is a set of vertices V and a set of edge E. An edge connects a pair of vertices. Vertices o the graph is shown as point or circle and edges are drawn as arcs or line segment.

**There are two types of graph:**

- Undirected graph
- Directed graph