In The Name of Allah The Most Mercifull and The Benificial
In The Name of Allah The Most Mercifull and The Benificial
[email protected]
[email protected]
Course Information
3-Credit Hours Course
Course Title:
Introduction to Data Structure and Algorithm
Textbooks:
Data Structure in C++ by CM Aslam, TA Qureshi
Data Structure using C++ by DS Malik
Data Structure and Algorithm Analysis in C, Addison
Wesley, 1997.
Data Structures and Algorithms (SAMS teach
yourself), Lafore, Sams Publishing, 1999.
Grading:
Quizzes (10) Announced/Unannounced
Assignment (5)
project/presentation (10),
Midterm test (25%)
Final exam (50%)
Introduction to Data
Structure and Algorithm
BS-3rd Term
Department of CS&IT
University of Gujarat
What you will learn
AL 7
Organizing Data
Any organization for a collection of records
that can be searched, processed in any
order, or modified.
The choice of data structure and algorithm
can make the difference between a program
running in a few seconds or many days.
AL 8
Efficiency
A solution is said to be efficient if it solves
the problem within its resource constraints.
Space
Time
AL 9
Selecting a Data Structure
Select a data structure as follows:
1. Analyze the problem to determine the
resource constraints a solution must meet.
2. Determine the basic operations that must be
supported. Quantify the resource
constraints for each operation.
3. Select the data structure that best meets
these requirements.
AL 10
Some Questions to Ask
Are all data inserted into the data structure
at the beginning, or are insertions
interspersed with other operations?
Can data be deleted?
Are all data processed in some well-defined
order, or is random access allowed?
AL 11
Data Structure Philosophy
Each data structure has costs and benefits.
Rarely is one data structure better than
another in all situations.
A data structure requires:
space for each data item it stores,
time to perform each basic operation,
programming effort.
AL 12
Goals of this Course
“Well, Java”
http://www.answers.com/topic/programming-language
Structured Programming
Structured programming
Disciplined approach to writing
programs
Clear, easy to test and debug and easy
to modify
Structured programming is hard
and takes time to master
Structured Programming…….
Discipline for organizing and coding
programs.
Simplifies control paths so that
programs can be easily understood
and modified.
Uses basic control structures and
modules that have only one entry
point and one exit point.
Control Structures
Basic Control Constructs
Sequence Structure
Selection Structure
Iteration Structure
control passing
unconditionally from one
statement to the next.
The program executes Increment B
Statement A followed by Counter
Statement B.
Selection Construct
Information
52
Data Structures
Goal: to organize data
Criteria: to facilitate efficient
storage of data
retrieval of data
manipulation of data
Design Issue:
select and design appropriate data
types. (This is the real essence of OOP.)
53
Categories of Data Structures
Primitive or nonlinear data structure
SELECTION STATEMENTS
LOOPING STATEMENTS
SUB ALGORITHMS
Type of Sub-Algorithm
Function sub-algorithm
Procedure sub-algorithm
Another definition
Informally, an algorithm is any well defined
computational procedure that takes some value, or set
of values, as input and produces some value, or set of
values, as output.
Thus an algorithm is a sequence of computational
steps that transform the input into the output.
Algorithm is a tool to solve computational problem.
Example of an algorithm
Operations on Arrays
Insert
Delete
Traversing