You are on page 1of 12

Data Structures and Algorithms

CSCP-2034

UNIVERSITY OF CENTRAL PUNJAB FSD CAMPUS 1


Todays Agenda
•Introduction of Course
•What is Data Structure ?
•Importance of Data Structure
•What is an Algorithm?
•Importance of the Algorithm

UNIVERSITY OF CENTRAL PUNJAB FSD CAMPUS 2


Course Objectives
•To introduce the students to basic data structures and their
associated algorithms.
•To develop the skills to analyze time and space requirements for a
data structure and its associated algorithms.
•To implementing data structures in C++
•To determine, which data structures are appropriate in various
situations.

UNIVERSITY OF CENTRAL PUNJAB FSD CAMPUS 3


Course Contents
•Arrays
•Lists and Linked Lists
•Stacks
•Queues
•Recursion
• Tree Data Structure
•Heap
•Graph
•Hashing
UNIVERSITY OF CENTRAL PUNJAB FSD CAMPUS 4
Data Structure
•A data structure is a particular way of storing and organizing data in
a computer so that it can be used efficiently.
•Data structures determine the way in which information can be
stored in computer and used

UNIVERSITY OF CENTRAL PUNJAB FSD CAMPUS 5


Algorithm
•Any computing problem can be solved by executing a series of
actions in a specific order, that is called algorithm
•Algorithm is a well-defined computational function or procedure
that take some value or set of values as an input and produces some
value or set of value as an output

UNIVERSITY OF CENTRAL PUNJAB FSD CAMPUS 6


UNIVERSITY OF CENTRAL PUNJAB FSD CAMPUS 7
Algorithm Writing..
•It should be language independent
•Algorithm can be written in any manner unless they provide the
solution of a problem
•Two styles are normally used
◦ Pseudo-code
◦ Flow Chart

UNIVERSITY OF CENTRAL PUNJAB FSD CAMPUS 8


Example: Determine Whether A
Student Passed the Exam or Not
Algorithm (Pseudo-code Example)
Step 1: Input grades of 4 courses M1, M2, M3 and M4,
Step 2: Calculate the average grade with formula "Grade=(M1+M2+M3+M4)/4"
Step 3: If the average grade is less than 60, print "FAIL", else print "PASS".

UNIVERSITY OF CENTRAL PUNJAB FSD CAMPUS 9


Flow Chart Example

UNIVERSITY OF CENTRAL PUNJAB FSD CAMPUS 10


Algorithm History
•First used by Abu Ja’far Muhammed Ibn Musa al-Khowarizmi (780-850)
•Original word “algorism” , This word evolved into the word of Algorithm in
eighteen century
•He give the concept of “zero”
•Western Europe first learned Algebra from him
•Algebra comes from al-jabr, part of title of his book kitab al-jabr w’al muquabala

UNIVERSITY OF CENTRAL PUNJAB FSD CAMPUS 11


Recommended Books
1. Data Structures and Algorithm Analysis by Clifford A. Shaffer (Latest
Edition)
2. Data Structures and Algorithm Analysis in C++ by Mark Allen Weiss
(Latest Edition)

Reference Book
Introduction to Algorithms by Thomas H. Cormen, Charles E. Leiserson,
Ronald L. Rivest and Clifford Stein, (Latest Edition), MIT Press

UNIVERSITY OF CENTRAL PUNJAB FSD CAMPUS 12

You might also like