• No results found

lecture-2-ds-definitions-2011-1.pdf

N/A
N/A
Protected

Academic year: 2020

Share "lecture-2-ds-definitions-2011-1.pdf"

Copied!
8
0
0

Loading.... (view fulltext now)

Full text

(1)

Data structures and algorithms

Data structures and algorithms

Program design= algorithm + data

g

g

g

Algorithm: is a logical sequence of steps that

describes a complete solution to a given

problem computable in a finite amount of time

problem computable in a finite amount of time.

Analysis of algorithms is used to predict the

efficiency of the algorithms in order to select

th b

t

the best one.

Analysis can be done on the:

1

Space (size)

1. Space (size)

2. Time (Speed)

(2)

Data

• Our world is full of DATA that need to be processed, so what is data?

Data : are nouns of the programming world: the objects that are manipulated, the information that is processed by a computer program.

Data: The representation of information in a manner suitable for • Data: The representation of information in a manner suitable for

communication or analysis by humans or machines

• In the context of a programming language, the term p g g g g

data

refers to the representation of such information, from the problem domain, by the data types available in the language.

• Data from the computer point of view is just a collection of bits (1,0) • Data from the human beings point of view is numbers, names, lists

(3)

Data abstraction

Data abstraction

• Data abstraction: the separation of data type’s

p

yp

logical properties from its implementation.

• Ex. Integers can be physically represented as:

i

d

i

d BCD 2’

l

signed, unsigned, BCD, 2’s complement ….

• But As a programmer, however, you don’t

usually get involved at this level; you simply use

usually get involved at this level; you simply use

integers. All you need to know is how to declare

an int type variable and what operations are

(4)

Thinking

Thinking…

• In order to use the data in an efficient way we have to answer some questions such as :

questions such as :

• How to store data in a Computer Program? • How to organize the involved Data?

• How data are arranged in relation to each other?How data are arranged in relation to each other? • Which operations and parameters?

• Which data are kept in the memory? • Which are calculated when needed?

• Which are kept in files, and how the files are arranged? • Which method is more efficient?

• Which Programming Language?

(5)

Data Structures

Data Structures

• We need to organize our Data used in a program In data

g

p g

structures

• We need to specify such Data Structures

• Specification of Data Structures can be done through

what called an Abstract Data Types (ADT) that

describes:

describes:

• The Types of Data

(6)

Data Structures

Data type A category of data characterized by the supported elements of the category and the supported operations on those elements

Atomic or primitive typeAtomic or primitive type A data type whose elements are single none-A data type whose elements are single, none decomposable data items

• In effect, all the Java built-in types are ADTs (Abstract Data Types). A Java programmer can declare variables of those types without understanding the underlying implementation. The programmer can initialize, modify, and

u de y g p e e a o e p og a e ca a e, od y, a d

access the information held by the variables using the provided operations. • Abstract data type: is to define the domain and the structure of the data a

long with a collection of operations that access the data without implementation dependency

• Ex. Integer : N , { +, -,*, / }

Boolean: { true, false} , {and , or, not xor }

Data structure A collection of data elements whose logical organization reflects a relationship among the elements. A data structure is characterized reflects a relationship among the elements. A data structure is characterized by accessing operations that are used to store and retrieve the individual data elements.

(7)

Data Levels

• In modeling data in a program, we must determine the

abstract properties of the data, choose the

representation of the data, and develop the operations

p

,

p

p

that encapsulate this arrangement. During this process,

we consider data from three different levels:

1.

Logical (or abstract) level:

An abstract view of the data

values (the domain) and the set of operations to

manipulate them. At this level, we define the ADT.

2.

Application (or user) level:

A way of modeling real-life

d t i

ifi

t

t

l

ll d th

bl

data in a specific context; also called the problem

domain. Here the application programmer uses the ADT

to solve a problem.

3

I

l

t ti

l

l

A

ifi

t ti

f th

(8)

Aims of studying Data structures

Aims of studying Data structures

1 analysis and tradeoffs (advantages

1. analysis and tradeoffs (advantages,

disadvantages).

2 time efficiency (organize data so that the

2. time efficiency (organize data so that the

algorithms used to access it are efficient in

time)

time).

References

Related documents

• Solid dosage forms, direct compression, wet and dry granulation, capsules, powders and sugar spheres. • Liquid dosage forms, syrups, solutions, suspensions,

The projected gains over the years 2000 to 2040 in life and active life expectancies, and expected years of dependency at age 65for males and females, for alternatives I, II, and

South European welfare regimes had the largest health inequalities (with an exception of a smaller rate difference for limiting longstanding illness), while countries with

The ethno botanical efficacy of various parts like leaf, fruit, stem, flower and root of ethanol and ethyl acetate extracts against various clinically

Learning Program Compilation Learning Coordination Resource Localization Communication Mediation Competency Gap Analysis Learning Assistant Learning Platform Communication

12 Data Science Master Entrepreneur- ship Data Science Master Engineering entrepreneurship society engineering. Eindhoven University of Technology

For the poorest farmers in eastern India, then, the benefits of groundwater irrigation have come through three routes: in large part, through purchased pump irrigation and, in a

The differential diagnosis of lung transplant patients with declining allograft function weeks to months after transplant includes acute rejection, infection, airway complications