Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Data Design - Data Structures - Lecture Slides, Slides of Data Structures and Algorithms

In the subject of the Data Structures, the key concept and the main points, which are very important in the context of the data structures are listed below:Data Design, Representation, Information, Communication, Analysis, Humans or Machines, Manipulated, Information, Logical Properties, Implementation

Typology: Slides

2012/2013

Uploaded on 04/23/2013

saratey
saratey 🇮🇳

4.3

(10)

87 documents

1 / 93

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Chapter 2
Data Design and
Implementation
1
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d

Partial preview of the text

Download Data Design - Data Structures - Lecture Slides and more Slides Data Structures and Algorithms in PDF only on Docsity!

Chapter 2 Data Design and Implementation

  • Lecture

Data Abstraction

  • Separation of a data types logical properties from its implementation

4

LOGICAL PROPERTIES IMPLEMENTATION

What are the possible values? How can this be done in C++?

What operations will be needed? How can data types be used?

APPLICATION

0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1

REPRESENTATION

Data Encapsulation

  • is the separation of the representation of data from the applications that use the data at a logical level; - a programming language feature that enforces information hiding

5

int y;

y = 25;

Abstract Data Type (ADT)

  • A data type whose properties (domain and

operations) are specified independently of any particular implementation.

Collection ordered in different ways

Communication between the Application Level and Implementation Level

Viewing a library from 3 different levels

  • Application (or user) level: Library of Congress, or Baltimore County Public Library.
  • Logical (or ADT) level: domain is a collection of books; - operations include: check book out, check book in, pay fine, reserve a book.
  • Implementation level: representation of the structure to hold thebooks, and the coding for operations.

4 Basic Kinds of ADT Operations

  • Constructor -- creates a new instance (object) of an

ADT.

  • Transformer -- changes the state of one or more of

the data values of an instance.

  • Observer -- allows us to observe the state of one or

more of the data values without changing them.

  • Iterator -- allows us to process all the components in

a data structure sequentially.

Two Forms of Composite Data Types

UNSTRUCTURED

14

Components are not organized with respect to one another.

The organization determines method used to access individual data components.

STRUCTURED

EXAMPLES: EXAMPLES: arrays classes and structs

Records

A record is a composite data type made up of a finite collection of not necessarily homogeneous elements called members or fields****. For example...

16

.year 2008

.makerh ’‘ o ’‘ n ’‘ d’a’\0...

.price 18678.

thisCar at Base Address 6000

struct CarType

struct CarType {

int year; char maker[10]; float price;

} ;

CarType thisCar; //CarType variable s CarType myCar;

Valid struct operations

  • Operations valid on an entire struct type variable:

assignment to another struct variable of same type,

pass as a parameter to a function (either by value or by reference),

return as the value of a function.

Pass-by-value

20

CALLING BLOCK

FUNCTION CALLED

sends a copy of the contents of the actual parameter

SO, the actual parameter cannot be changed by the function.