17
In-Service course for PGT Computer Science 2009

DATA STRUCTURE

  • Upload
    joella

  • View
    17

  • Download
    0

Embed Size (px)

DESCRIPTION

DATA STRUCTURE. In-Service course for PGT Computer Science 2009. Presented by -. Group I Ms. Pankaj Choudhary PGT (Computer Sc.) Kendriya Vidyalaya, Sriganganagar Cantt. In-Service course for PGT Computer Science 2009. Contents -. Definition Classification of Data Structure - PowerPoint PPT Presentation

Citation preview

Page 1: DATA  STRUCTURE

In-Service course for PGT Computer Science 2009

Page 2: DATA  STRUCTURE

PRESENTED BY -

Group IMs. Pankaj Choudhary

PGT (Computer Sc.)

Kendriya Vidyalaya,

Sriganganagar Cantt.

In-Service course for PGT Computer Science 2009

Page 3: DATA  STRUCTURE

CONTENTS -

DefinitionClassification of Data StructureTypes of Data StructureSimple Data StructureCompound Data StructureLinear Data StructureNon-Linear Data StructureOperations on Data Structure

In-Service course for PGT Computer Science 2009

Page 4: DATA  STRUCTURE

DEFINITION -

A Data Structure is a named group of data of different data types which can be processed as a single unit.

Data Structure is a logical or mathematical model of a particular organization of data and specify operation on it, it is called Data Structure.

In-Service course for PGT Computer Science 2009

Page 5: DATA  STRUCTURE

CLASSIFICATION OF DATA STRUCTURE -

Logical Data Structure

Logical Data Structure is the relationship among data elements in a Data Base.

Physical Data Structure

Physical Data Structure tells us how the data is actually physically stored.

In-Service course for PGT Computer Science 2009

Page 6: DATA  STRUCTURE

TYPES OF DATA STRUCTURE -

In-Service course for PGT Computer Science 2009

Page 7: DATA  STRUCTURE

SIMPLE DATA STRUCTURE -

Definition :- These data structures are normally built from primitive data types like integer, real, characters and boolean.

Eg. Arrays, Structure.

In-Service course for PGT Computer Science 2009

Page 8: DATA  STRUCTURE

CLASSIFICATION OF SIMPLE DS -I. Array – Arrays refer to a named list of a finite

number n of similar data elements, referenced respectively by set of n consecutive numbers; usually 0,1,2,……,n-1. eg. A[0], A[1], A[2], …….., A[9] Where A is an array of size 10

II. Structure – Structure refers to a named collection of variables of different data types.

Syntax: Struct struct_name

{

DataTypes(field1);

Field2;

:

} struct_object;

In-Service course for PGT Computer Science 2009

Page 9: DATA  STRUCTURE

COMPOUND DATA STRUCTURE -

Definition :- Simple data structures can be combined in various ways to form more complex structures called compound data structures.

Eg. Stack, Queue, etc.

In-Service course for PGT Computer Science 2009

Page 10: DATA  STRUCTURE

CLASSIFICATION OF COMPOUND DS -

I. Linear Data Structure – In linear data structure processing of data items is in linear fashion ie; Data can be processed one by one sequentially. Eg. Stack, Queue, Linked List.

II. Non-linear Data Structure – A data structure in which insertin & deletion is not possible in linear fashion is called non-linear data structure. These are multilevel data structures. Eg. Tree.

In-Service course for PGT Computer Science 2009

Page 11: DATA  STRUCTURE

TYPES OF LINEAR DS -

a) Stack – The stack in an ordered collection of items into which items may be inserted or deleted at one end, known as to ‘TOP’ of the stack. Stack is also known as LIFO (Last In First Out) i.e. In a stack last inserted item will be the first to be deleted.

TOP

 

 

D

C

B

A

In-Service course for PGT Computer Science 2009

Page 12: DATA  STRUCTURE

b) Queue – The queue is a linear list in which insertion can take place at one end, the ‘rear’ and deletion take place at the other end, the ‘front’ of the list. Queue is also known as FIFO(First In First Out). i.e. In a queue first inserted item will be the first to be deleted.

front rear

a b c d

In-Service course for PGT Computer Science 2009

Page 13: DATA  STRUCTURE

c) Linked List – A linked list can be defined as collection of nodes. A node has two fields : INFO that contains information and ADD field that contains the address of next node i.e. pointer to the next node. Linked list can be peresented as follows:

INFO ADD

START

In-Service course for PGT Computer Science 2009

Page 14: DATA  STRUCTURE

TYPES OF NON LINEAR DS -a) Tree – Data frequently contain a hierarchical

relationship between various elements known as nodes. The data structure which reflects this relationship is called a tree. Top most node is called the root and bottom most nodes are called leaves of the tree.

a

cb

gfed

In-Service course for PGT Computer Science 2009

Page 15: DATA  STRUCTURE

OPERATIONS ON DATA STRUCTURE -

The basic operations performed on data structure are :

1. Insertion – means addition of a new data element in a data structure.

2. Deletion – means removal of a data element from a data structure. The data element is searched before its removal.

Continue..

In-Service course for PGT Computer Science 2009

Page 16: DATA  STRUCTURE

3. Searching – involves searching for a specified data element in a data structure.

4. Traversal – means processing of all the data elements of the data structure.

5. Sorting – means arranging the data elements in a specified order.

6. Merging – combining elements of two similar data structures to form a new data structure of same type.

In-Service course for PGT Computer Science 2009

Page 17: DATA  STRUCTURE

In-Service course for PGT Computer Science 2009