## Introduction

• Data structure are used in almost every program/software system.
• It is a data storage format to store different types of computer data in different way.

## Definition

• Logical organisation of data in the memory/file of the computer for better storage purpose is known as data structure.
• Data structure is a specific way of storing and organizing data in a computer’s memory so that it can be used efficiently later.
• The term data structure is used to describe the way data is stored in the computer’s memory.

## Features

• Data structure allows improvement in program efficiency.
• Data structure is a representation of logical relationship existing between individual elements of data.
• Data structures and algorithms are interrelated i.e. Algorithm + Data structure = Program.

## Example

• Example of data structure are Array, String, Linked list, Stack, Queue, Tree, Graph, Heap, Hash table etc.

## Types of Data Structure

###### (a) Linear Data Structure
• When the data/data elements are arranged sequentially/one after another in a linear order, it is called linear data structure.
• A data structure is said to be linear if its elements form a sequence or a linear list.
• They are of two types –
• Contiguous Data Structure – Example – Array, String.
• When the data/data elements are arranged/kept together in memory (either RAM or in a file) sequentially/one after another in continuous memory location in a given order, is called contiguous linear data structure.
• Contiguous data structure can be broken drawn further into two kinds: those that contain data items of all having same type and size i.e. an array)where each element is of the same type and size The other kind of contiguous structure is called structure, where each element may be of different data types and thus may have different sizes.
• Non-contiguous Data Structure – Example – Linked list, Stack, Queue
• When the data/data elements are arranged/kept sequentially/one after another but scattered (not contiguous) in the memory i.e. here and there in the memory, is called non-contiguous linear data structure.
• Non-contiguous data structures are implemented as a collection of data-items, each data-item is called node, where each node can point to one or more other nodes in the collection.
• The simplest kind of non-contiguous structure is linked list. A linked list represents a linear, one-dimension type of non-contiguous structure, where there is only the notation of backwards and forwards.
• A tree is an example of a two-dimensional non-contiguous structure. Here, there is the notion of up and down and left and right.In a tree each node has only one link that leads into the node and links can only go down the tree.
• The most general type of non-contiguous structure, called a graph has no such type of restrictions.
• Hybrid Data Structure
• When two basic types of structures are mixed it creates a hybrid form where one part may be contiguous and another part non-contiguous.
• Example – doubly linked list.
###### (B) Non-linear Data Structure
• When the data/data elements are arranged in an unorganized manner in the memory of a computer, it is called non-linear data structure.
• This structure is mostly used for representing data that contains a hierarchical relationship among various elements with different data items.
• A data structure is said to be non linear if its elements form a hierarchical classification where, data items appear at various levels.
• They are of two types –
• Non-Cyclic Data Structure – Example – Tree.
• Cyclic Data Structure – Example – Graph.
###### (B) On the basis of the structure/nature of Data, Data structures are further divided into two           types: –

(a) Primitive Data Structures :

• These are the basic data structures that directly operate upon the machine instructions.
• They have different representations on different computers in the form of  Integers, floating point numbers, character constants, string constants and pointers.

(b) Non-primitive Data Structures :

• These are more complicated data structures and are derived from primitive data structures.
• They emphasize on grouping same or different data items with relationship between each data item.
• Examples are – Arrays, lists (Linear and Non-linear both) and files come under this category.

## Use of Data Structure

• Different kinds of data structure are suited  to store different kinds of application’s data and some are highly for specific tasks. For example – B-tree for databases, Hash table for compiler etc.
• Data structure provide a way to manage huge amount of data efficiently such as large databases, internet indexing services etc.

1,573 total views,  1 views today

Categories: Data Structure