data structures introduction

Post on 14-Jul-2016

19 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

basic concepts of data structures

TRANSCRIPT

DATA STRUCTURES

WHY DO WE NEED DATA STRUCTURES?

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

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,

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.

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

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.

STRUCTURE OF AN ALGORITHM:

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

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.

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

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.

CLASSIFICATION

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.

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.

END

top related