data structures introduction

15
DATA STRUCTURES

Upload: surekha

Post on 14-Jul-2016

18 views

Category:

Documents


0 download

DESCRIPTION

basic concepts of data structures

TRANSCRIPT

Page 1: Data Structures Introduction

DATA STRUCTURES

Page 2: Data Structures Introduction

WHY DO WE NEED DATA STRUCTURES?

Page 3: Data Structures Introduction

COMPUTERS ARE EVERYWHERE

• Omnipresence of computers leads to the need for Algorithms• Any discipline calls for problem solving• Problem solved Efficiently with effective methods.• Problem can be solved with the mix of four

fundamental areas:

machines Languages

Foundations Technologies

Page 4: Data Structures Introduction

CONTD..

• Machines- Processing Power, memory capacity, etc.. needed for efficient execution of the solution• Languages – Choice of language , its constraints,

version,• Foundations- Model of the problem, methods to

be implemented, performance measure• Technologies – web based, mobile based, cloud

based,

Page 5: Data Structures Introduction

INTRODUCTION TO DS

• Core fields that belong to the FOUNDATIONS deal with design , analysis and implementation of algorithms for efficient solutions.• An algorithm can be defined as a process,

procedure or a recipe[ A specific set of rules to obtain a definite output from a set of specific inputs]• Data structures deals with the design and

implementation of efficient algorithms.• Ds deals with the study of methods techniques

and tools to organize or structured data.

Page 6: Data Structures Introduction

ALGORITHM

• The word algorithm originates from the Arabic word, algorism which is linked to the Arabic mathematician Abu Jafar Mohammed Ibn Musa Al Khwarizmi(825 AD), who designed the first algorithm for adding two numbers.

987 76+

987 76+

(carry 1)

987 76+

(carry 1)

(carry 1) 3

63 1063

Page 7: Data Structures Introduction

DEFINITION OF AN ALGORITHM:

• An Algorithm may be defined as a finite sequence of instructions, each of which has a clear meaning performed within a finite amount of effort in a finite length of time.

Page 8: Data Structures Introduction

STRUCTURE OF AN ALGORITHM:

• Input Step• Assignment Step• Decision step• Repetitive Step• Output Step

Page 9: Data Structures Introduction

CHARACTERISTICS OF AN ALGORITHM:

• Finiteness – Must terminate in a finite number of steps• Definiteness – steps clearly defined or unambiguously

specified.• Generality – generic to solve all problems of a particular

class• Effectiveness – Keep it simple and sweet, basic enough• Input- Output – An Algorithm must have certain initial

inputs and outputs may be intermediate and final.• An algorithm does not enforce any language. An

algorithm may be represented pictorial using flowcharts.• An algorithm encoded in a programming language is a

program.

Page 10: Data Structures Introduction

DEVELOPMENT OF AN AGORITHM:

• The steps involved in the development of an algorithm are:• Problem Statement- clear statement of the problem• Model Formulation – mode for the solution is to be

formulated• Algorithm Design – [role of DS begins here] right choice

of DS needs to be implemented for the efficiency of the algorithm

• Algorithm Correctness- Check for correctness• Implementation – Write a code• Algorithm Analysis – measuring the performance of the

algorithm in terms of time and space.• Program Testing• Documentation

Page 11: Data Structures Introduction

DATA STRUCTURES AND AGORITHMS

• Design of “efficient” algorithm for the solution of the problem calls for the need of appropriate “data structures”.• Data on which the algorithm works should be

appropriately structured.

Page 12: Data Structures Introduction

CLASSIFICATION

Page 13: Data Structures Introduction

ABSTRACT DATA TYPE

• A data type refers to the type of values that variables in a programming language hold. • A list of elements is called as a data object.• The data objects which comprise the data

structure and their fundamental operations are known as Abstract Data type(ADT).• ADT is defined as a set of data objects D

defined over a Domain L and supporting a list of operations O.

Page 14: Data Structures Introduction

EXAMPLE• Consider an ADT for the data structure of positive integers called

POSITIVE INTEGERS defined over a domain of integers Z+ supporting the operations of addition(ADD), Subtraction (SUB) and check if positive (CHECK_POSITIVE). The ADT is defined as follows:

• L = Z+ , D = {x | x € L } , O = { ADD, SUB, CHECK_POSITIVE }• Operations

• Addition of Positive integers INT1, INT2 into RESULTADD( INT1, INT2, RESULT)

• Subtraction of Positive integers INT1, INT2 into RESULTSUB( INT1, INT2, RESULT)

• Check if a number INT! is positive INT1, INT2 into RESULTCHECK_POSITIVE(INT1) (Boolean)

• An ADT promotes data abstraction and focuses on what a data structure does rather than how it does.

Page 15: Data Structures Introduction

END