Sunteți pe pagina 1din 35

CMP102

Data Structures and


Algorithms
Magda B. Fayek
CUFE Spring 2018
Introduction:
Preliminaries & ILOs
Regulations
 No entry is allowed after 15 mins
of lecture begin.
 Mobiles should be switched off.
 Questions are encouraged!
 Missing more than 25% of lectures
will be punished by depriving from
attending final exam.

3
Regulations
 Academic Dishonesty: Cheating and
Plagiarism will be very strictly
punished
 At the end of each lecture students
are encouraged to give a wrap-up of
the lecture, earning thereby bonus
points.
Assessment
 Semester:
 90 Final Exam
 20 Mid term
 5 Assignment+ Quizes
 35 Lab (20) + Project (15)
Assessment
 Credit:
 40 Final Exam
 20 Mid term …
 20 Lab
 15 Project
 5 Assignments + attendance + quizes 
Activities:
- Vote for
- BEST STUDENT
- Who is the
- Best Team member
- Best Team Leader
7
References:
 The e-learning site at:
http://elearning.eng.cu.edu.eg/
 Data Abstraction & Problem Solving
with C++
Walls and Mirrors
By Frank M. Carrano
Pearson International Edition,
Addison Wesley
References:
 Data Structures, A Pseudocode
Approach in C
By Richard F. Gilberg & Behrouz A.
Forouzan, second edition Thomson Course
Technology 2005
About the Reference Book
 Data Abstraction
& Problem Solving

Walls and Mirrors


 Problem solving is ranslated to

an ALGORITHM ( ?? )
 An Algorithm has a complexity
10
Mirrors

11
About the Reference Book
 Mirros represent one type of
algorithms in which the solution is
a repeated reflection decreasing
each time in size. It is called a
recursive algorithm.
 A recursive function calls itself,

each time decrementing its scope


and finally terminating with no
recursive call. 12
About the Reference Book

 Mirrors: They reflect a recursive


function, e.g.:
 A typical example is the

Factorial ……..

13
14
About the Reference Book
Now let us focus on
 Walls:

 What is an abstract data type (ADT)?


 What is a data structure?

 What is the difference?

 Consider a group of students


(BAG) 15
About the Reference Book
 Walls:
 To the program they are just a group
(or a bag) of students
 The program only specifies the main

operations (behaviour) it needs to


perform on the students group, it
does not see HOW they are
structured.
16
About the Reference Book

 Walls:
The operations specified by the
program (or user) determine the
suitable ADT but not the DATA
STRUCTURE by which the ADT is
represented.
 This is what ADT is all about.

17
About the Reference Book
 Walls:
 If the main operations are about
displaying students one at a time,
adding, deleting or finding a certain
stud then the ADT used will be
probably a LIST ADT.
 If in addition they need to be kept

sorted it will be a TABLE (dictionary)


ADT
18
About the Reference Book

 Walls:
 If the main operations are finding
the friendship or relation between
students then the ADT will be a
GRAPH

19
Walls
X

The program does not access the data structure!


The program only accesses the provided operations! 20
WALLS !

21
About the Reference Book
 Walls:
…. HENCE
For an ADT we DONOT see
how data is structured.
The operations on the ADT (interface)
determine the data structure most suitable
for implementing the operations.

22
About the Reference Book
 Our study will be concerned with:
 Different ADTs + their representation
 Implementation of different operations

on those ADTs (interface)


 Advantages and disadvantages of the

different data structures of an ADT

23
About the Reference Book
 To complete the image:
 The elements of the data structures
previously named “students” may vary
 They may be cities, tools , persons, …

 To keep our DATA STRUCTRUE general

the elements will be considered


“patterns” (e.g.list of student, city …) .
 In C++ patterns are called Templates

24
About the Reference Book
 We shall start with the simple LIST
ADT of very simple integer elements:
 We start by specifying the interface

(operations), then consider the two


implementations of list:
 Array
 Linked List

Emphasizing on the advantages of each


implementation, regarding the interface. 25
About the Reference Book

 Main operations of the List ADT are:


 Traversal
 Retrieval
 Adding (insertion at begin, mid or end)
 Deleting (at begin, mid (possibly performing a
search) or end)

26
About the Reference Book
 Then we shall consider how the template
definition can be used to generalize the LIST
ADT.
 Finally we shall proceed with other ADTs ( e.g.
stacks, queues, trees, graphs) using templates.
 Note that implementation details
will be YOUR responsibility
assisted by sections and LAb
27
Course Content
1. Preliminarie: Rules, Course
Overview, ILOs
2. List ADT
3. Templates
4. Recursion
5. Stack ADT and its applications
6. Queue ADT and its applications
7. Trees ADT and applications
28
Course Content
8. Algorithm Efficiency
9. Sorting: Simple Algorithms
10. Sorting: Advanced Algorithms
11. Graphs
12. Hashing

29
ILOs (Intended Learning
Outcomes)
1. Knowledge and Understanding
2. Intellectual Skills
3. Professional and Practical Skills
4. General and Transferable Skills

30
ILOs

1. Knowledge and Understanding


1. Basics of data structure types and
algorithm complexity and analysis
2. Design principles
3. Current technologies  STL

31
ILOs

2. Intellectual Skills
1. Analyze, select and synthesize
2. Think in a creative and innovative way
for solving problems
3. Investigate failures and find solutions

32
ILOs

3. Professional and Practical Skills


1. Re-design and improve design by
understanding and using feedback
2. Practice neatness and be perfectos
using specialized tools throughout
system development life cycle.

33
ILOs

4. General and Transferable Skills


1. Work in stressful environment
2. Be an effective team member/team
leader
3. Search for information and engage in
self learning

34
End of Slides

Data Structures: A Pseudocode 35

S-ar putea să vă placă și