basics of data structure

8
1 Basic Terminologies Basic Terminologies Data Structures Data Structures

Upload: rajendranjrf

Post on 14-Aug-2015

53 views

Category:

Education


6 download

TRANSCRIPT

Page 1: Basics of data structure

1

Basic Terminologies Basic Terminologies

Data StructuresData Structures

Page 2: Basics of data structure

DefinitionDefinition

Data Structure is a way of collecting and organizing Data Structure is a way of collecting and organizing data in such a way that we can perform operations on data in such a way that we can perform operations on these data in an effective way. Data Structures is these data in an effective way. Data Structures is about rendering data elements in terms of some about rendering data elements in terms of some relationship, for better organization and storage.relationship, for better organization and storage.

Data structures can implement one or more particular Data structures can implement one or more particular abstract data types (ADT), which are the means of (ADT), which are the means of specifying the contract of operations and their specifying the contract of operations and their complexity..

Design and Analysis of Algorithms Chapter 2.22

Page 3: Basics of data structure

3

Abstract Data Type (ADT)Abstract Data Type (ADT)• Mathematical description of an object with set of Mathematical description of an object with set of

operations on the object. Useful building block.operations on the object. Useful building block. AlgorithmAlgorithm

• A high level, language independent, description A high level, language independent, description of a step-by-step processof a step-by-step process

Data structureData structure• A specific family of algorithms for implementing A specific family of algorithms for implementing

an abstract data type.an abstract data type. Implementation of data structureImplementation of data structure

• A specific implementation in a specific languageA specific implementation in a specific language

TerminologyTerminology

Page 4: Basics of data structure

4

TerminologyTerminology DataData

Data refers to value or set of values. Data refers to value or set of values.

e.g.Marks obtained by the students.e.g.Marks obtained by the students. Data typeData type

data type is a classification identifying one of various data type is a classification identifying one of various typestypes

of data, such as floating-point, integer, or Boolean, that of data, such as floating-point, integer, or Boolean, that

determines the possible values for that type; the determines the possible values for that type; the operations operations

that can be done on values of that type; and the way that can be done on values of that type; and the way valuesvalues

of that type can be storedof that type can be stored

Page 5: Basics of data structure

5

TerminologyTerminology

Primitive data type:Primitive data type:

These are basic data types that are provided by theThese are basic data types that are provided by the

programming language with built-in support. These dataprogramming language with built-in support. These data

types are native to the language. This data type istypes are native to the language. This data type is

supported by machine directlysupported by machine directly

VariableVariable

Variable is a symbolic name given to some known or Variable is a symbolic name given to some known or

unknown quantity or information, for the purpose of unknown quantity or information, for the purpose of

allowing the name to be used independently of the allowing the name to be used independently of the

information it represents.information it represents.

Page 6: Basics of data structure

6

RecordRecord

Collection of related data items is known as record. The Collection of related data items is known as record. The

elements of records are usually Called fields or members elements of records are usually Called fields or members ..

Records are distinguished from arrays by the fact that Records are distinguished from arrays by the fact that

their number of fields is typically fixed, each field has a their number of fields is typically fixed, each field has a

name, and that each field may have a different type.name, and that each field may have a different type. ProgramProgram

A sequence of instructions that a computer can A sequence of instructions that a computer can

interpret and execute.interpret and execute.

TerminologyTerminology

Page 7: Basics of data structure

7

AA stack is an stack is an abstract data type abstract data type supporting push, pop supporting push, pop and isEmpty operationsand isEmpty operations

A stack A stack data structuredata structure could use an array, a linked list, could use an array, a linked list, or anything that can hold dataor anything that can hold data

One stack One stack implementationimplementation is java.util.Stack; another is is java.util.Stack; another is java.util.LinkedListjava.util.LinkedList

Terminology examplesTerminology examples

Page 8: Basics of data structure

8

AbstractAbstract PseudocodePseudocode AlgorithmAlgorithm

• A sequence of high-level, A sequence of high-level, language independent language independent operations, which may operations, which may act upon an abstracted act upon an abstracted view of data.view of data.

Abstract Data Type (ADT)Abstract Data Type (ADT)

• A mathematical A mathematical description of an object description of an object and the set of operations and the set of operations on the object.on the object.

AbstractAbstract PseudocodePseudocode AlgorithmAlgorithm

• A sequence of high-level, A sequence of high-level, language independent language independent operations, which may operations, which may act upon an abstracted act upon an abstracted view of data.view of data.

Abstract Data Type (ADT)Abstract Data Type (ADT)

• A mathematical A mathematical description of an object description of an object and the set of operations and the set of operations on the object.on the object.

ConceptsConcepts vs. vs. MechanismsMechanisms