Upload
blake-joseph-miller
View
218
Download
0
Tags:
Embed Size (px)
Citation preview
Data Structure Introduction
Dr. Bernard Chen Ph.D.University of Central Arkansas
Fall 2010
Outline
Software Development Abstract Data Type (ADT)
Software Development Hardware: actual physical components
(such as CPU, memory, hard drive…)
Software: refers to programs used to control the operation of the hardware. Is a complex process that is both art and
science Requires a good deal of imagination,
creativity and ingenuity
Hardware Progress Trend
1
10
100
1000
10000
1978 1980 1982 1984 1986 1988 1990 1992 1994 1996 1998 2000 2002 2004 2006
Pe
rfo
rma
nce
(vs
. V
AX
-11
/78
0)
25%/year
52%/year
??%/year
Software Development Phases
Problem Analysis and Specification Design Coding Testing, Execution, and Debugging Maintenance
Software Development Model
One of the earliest strategies for development software is known as the Waterfall Model
Waterfall Model
Realistic Waterfall Model
Software Development Phases
Problem Analysis and Specification
Design Coding Testing, Execution, and Debugging Maintenance
Problem Analysis and Specification
Problem Analysis and Specification: The problem is analyzed and a specification for the problem is formulated
For example: if we obtain a job request looks like:
Task Example
Because of new government regulations, we must keep more accurate record of all students currently receiving financial aid and submit regular report to FFAO (Federal Financial Aid Office). Could we get the computer to do this for us???
Task Analysis
Purpose Pre-condition (input): describe
the state of processing before the program is executed
Post-condition (output): describe the state of processing after the program is executed
Software Development Phases
Problem Analysis and Specification Design Coding Testing, Execution, and Debugging Maintenance
Design
Design: A plan for solving the problem is formulated
Various design methods have been developed, two of major designs we describe here: top-down design and object-oriented design
Top-down design The original problem is partitioned
into simpler sub-problems
For example, the problem we just had can be obviously divided into:
1. Get the student records2. Process the records3. Prepare the reports
One level partition
Two level partition
Three level partition
OOD: Object-Oriented Design Identify the objects
in the problem's specification and their types.
Identify the operations or tasks to manipulate the objects
Program=Algorithm + Data Structure
Algorithm: “a step by step procedure for solving a problem or accomplishing some end”
In computer science, algorithm must be:
1. Definite, unambiguous2. Simple3. Finite
Software Development Phases
Problem Analysis and Specification Design Coding Testing, Execution, and Debugging Maintenance
Coding There’s not much we can talk in
coding, you all know what it is. After you select the language, three major principles you need to follow:
1. Programs and Subprograms should be well structured
2. All source code should be documented3. It should be formatted in a style that
enhances its readability
Software Development Phases
Problem Analysis and Specification Design Coding Testing, Execution, and
Debugging Maintenance
Testing, Execution, and Debugging
Errors happen all the time!!!
There are three different points at which errors can be introduced:
1. Syntax errors2. Run-time errors3. Logic errors
The "V" Life Cycle Model
Two major types of testing Black box testing:Outputs produced for various inputs
Checked for correctness Do not consider structure of program
component itself.
(so basically, it just test a lot of different inputs and match with the expected outputs )
Two major types of testing
White box testing:examine code’s internal structure(Test for every loop, if statement,
functions…)
Test data is carefully selected
Software Development Phases
Problem Analysis and Specification Design Coding Testing, Execution, and Debugging Maintenance
Maintenance After the software has
been used for several years, they will require modifications
Studies show that a higher percentage of computing budgets and programmer time are devoted to software maintenance
1970s 35-40%
1980s 40-60%
1990s 70-80%
2000s 80-90%
Program
Algorithms + Data Structure = Programs
Algorithms: Must be definite and unambiguous Simple enough to carry out by computer Need to be terminated after a finite
number of operations
Outline
Software Development Abstract Data Type (ADT)
A first look an ADTs Solving a problem involves processing data, and
an important part of the solution is the careful organization of the data
In order to do that, we need to identify:1. The collection of data items 2. Basic operation that must be performed on them
Abstract Data Type (ADT): a collection of data items together with the operations on the data
Abstract Data Type (ADT)
The word “abstract” refers to the fact that the data and the basic operations defined on it are being studied independently of how they are implemented
We think about what can be done with the data, not how it is done
Implementation of ADT
An implementation of ADT consists of storage structures to store the data items and algorithms for basic operation
Data Structures, Abstract Data Types, and Implementations
Consider example of an airplane flight with 10 seats to be assigned
Tasks List available seats Reserve a seat
How to store, access data?
Data Structures, Abstract Data Types, and Implementations
Consider example of an airplane flight with 10 seats to be assigned
Tasks List available seats Reserve a seat
How to store, access data? 10 individual variables
Use 10 individual variables Algorithm to List
available seats
1. If seat1 == ‘ ’:display 1
2. If seat2 == ‘ ’: display 2
.
.
.10. If seat10 == ‘ ’:
display 10
Algorithm to Reserve a seat
1. Set DONE to false2. If seat1 ==‘ ’:
print “do you want seat #1??”Get answerif answer==‘Y’:
set seat1 to ‘X’set Done to True
3. If seat2 ==‘ ’:print “do you want seat #2??”Get answerif answer==‘Y’:
set seat2 to ‘X’set Done to True
.
.
.
Data Structures, Abstract Data Types, and Implementations
Consider example of an airplane flight with 10 seats to be assigned
Tasks List available seats Reserve a seat
How to store, access data? 10 individual variables An array of variables
Use Array Algorithm to List available seats
For number ranging from 0 to max_seats-1, do:If seat[number] == ‘ ’:
Display number
Algorithm to Reserve a seat
Readin number of seat to be reservedIf seat[number] is equal to ‘ ’:
set seat[number] to ‘X’Else
Display a message that the seat having this number is occupied
ADTs In this simple example, it does illustrate the
concept of an Abstract Data Type
ADT consists of1. The collection of data items 2. Basic operation that must be performed on
them
In the example, a collection of data is a list of seats
The basic operations are (1) Scan the list to determine which seats are occupied (2) change seat’s status
Data Structure and Abstract Data Type The term of Data Structure and Abstract
Data Type are often used interchangeably
However, we use ADT when data is studied at a logical level
The term data structure refers to a construct in programming language that can be used to store data