# Introduction to Data Structure

Types of Data Structure

This is my first article in Learning Data Structure Series. This series is intended to help Computer Science students to understand various concepts of Data Structure, their use and different operations involved to access data efficiently.

Let us start our discussion with the term data. Data refers to a set of elements. This data can be organized in computer in different ways so that it can be accessed efficiently. This logical organization of data is known as Data Structure.

There are different kinds of data structures which can be used for different purposes such as array can be used to process same type of data linearly where as tree is used to implement data base.

## Basic Data Structures

1. Array
3. Stack and Queue
4. Tree and Graph

Let me introduce these data structures in short.

Array:
It’s the simplest linear type of data structure in which finite number of elements is stored in continuous memory.

Example 1:

 Index 0 1 2 3 4 5 6 7 8 Value 10 15 2 35 60 45 9 12 80

Example 2: Student

 Index Value 0 Ramesh 1 Sunita 2 Radhika 3 Mohan 4 Sameer

It’s again a linear collection of data element but in this linear order is given by means of pointer. So the data element is divided into two parts: the first part is known as information part and second part is known as link part.

Stack & Queue:
Stack is a special data structure in which data elements are processed in Last-in-First-out manner. It’s again a linear list but insertion and deletion can take place only at one end of list.

A Queue is also a linear list in which data elements are processed in First-in–First-out way.

Stack and Queue Data Structure

Tree & Graph:
These both are non-linear type of data structure. Tree represents hierarchical relationship between data elements whereas graph represents a relationship between pairs of elements. In graph, it’s not compulsory to have hierarchical relation between elements.

Tree and Graph Data Structure

The data in above all data structure can be processed by means of certain operations. Actually, which data structure should be use for particular situation is largely dependent on type and the frequency of operation to be performed on the data.

## Basic Data Structure Operations

Traversing refers to accessing each data element exactly once
Inserting refers to adding a new data element to the structure
Deleting refers to removing an element from the structure
Searching refers to finding the location of element in the structure
Sorting refers to arranging the elements in a logical order
Merging refers to combining to different records to make one record

Next article in Learning Data Structure Series is