You are on page 1of 29

Lecture 01: Introduction CS221 Data Structures & Algo.

Introduction

Dr. Zahid Halim

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 01: Introduction CS221 Data Structures & Algo.

Instructor
Email: zahid.halim@giki.edu.pk
Webpage: https://www.minrg.org/zahid
Office: G05
Telephone Extension: 2263
Office Hours:
Wednesday/Thursday 9:00 AM - 4:00 PM

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 01: Introduction CS221 Data Structures & Algo.

Course TA
• Mr. Aadam

• Never hesitate to contact TA or me whenever you have some


problem

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 01: Introduction CS221 Data Structures & Algo.

Some Rules
• There is only one rule that will make the rest of the rules
– Raise your hand before asking any question and then WAIT for the
permission
– Never ever Miss a class
– Never ever “sleep” in the class
– Always communicate in the official communication language
– Never even think about using mobile during the class

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 01: Introduction CS221 Data Structures & Algo.

Books
Introduction to Algorithms
Thomas H. Cormen et al
[Code : C]

Data Structures and Algorithms


A. V. Aho, J. E. Hopcroft, J. D. Ullman
[Code : B]

Data Structures Using C and C++


Y. Langsam, M. J. Augenstein, A. M. Tenenbaum
[Code : A]

Data Structures and Algorithm Analysis in C


Mark Allen Weiss
[Code: D]

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 01: Introduction CS221 Data Structures & Algo.

Dishonesty, Plagiarism in Quizzes, Assignments


• All individuals involved in any kind of cheating in any exam,

quiz, assignment or project will get -50% score.

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 01: Introduction CS221 Data Structures & Algo.

Attendance
• Students are required to attend 100% classes of courses
registered and cannot abstain from even a single class.

• For circumstances beyond their control, students must apply


for leave on prescribed Leave Application form.

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 01: Introduction CS221 Data Structures & Algo.

Quizzes
• Announced
• Unannounced

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 01: Introduction CS221 Data Structures & Algo.

Tentative Evaluation Breakdown

Assignments (8) 15
Quizzes (8) 10
Term Project (2 phases) 15
Midterm (1) 20
Final (1) 40

Total 100

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 01: Introduction CS221 Data Structures & Algo.

Course Execution
• Three lectures of one hour every week
• Course website: http://cms.giki.edu.pk

See schedule

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 01: Introduction CS221 Data Structures & Algo.

Course Outline
• In this course you will learn
– Introduction
– Algorithm Analysis
– Abstract Data Types (ADTs)
– Lists, Stacks, and Queues
– Trees
– Hashing
– Queues
– Sorting
– Graph Algorithms
– Algorithm Design Techniques

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 01: Introduction CS221 Data Structures & Algo.

Motivation!

Marie Curie

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 01: Introduction CS221 Data Structures & Algo.

What is a data structure exactly?

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 01: Introduction CS221 Data Structures & Algo.

To answer that, we must first understand:

What is a computer program?

Some mysterious
processing
Input Output

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 01: Introduction CS221 Data Structures & Algo.

How to solve the following problems:

1. Input 3 numbers, print out the maximum.

2. Input 30000 numbers, print out the largest 10 numbers.

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 01: Introduction CS221 Data Structures & Algo.

Data structures let the input and output be represented


in a way that can be handled efficiently and effectively.

array

Linked list

queue
tree
stack
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 01: Introduction CS221 Data Structures & Algo.

Some mysterious
processing
Input Output

Data structures+Algorithms=Programs

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 01: Introduction CS221 Data Structures & Algo.

Definition
• Data may be organized in different ways

• Data structure is the logical or mathematical model of a particular organization of


data

– Must be rich enough to mirror the actual relationships of the data in the real world
sample

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 01: Introduction CS221 Data Structures & Algo.

Arrays

1 Ali

2 Salam

3 Usman

4 Danial
Liner Arrays

5 Saeed

6 Zaka

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 01: Introduction CS221 Data Structures & Algo.

Array

Ali        
Salam   A B C
Usman        
Danial        
Saeed   Y    
Zaka   X    
Ali   Y    
Salam   X    
Usman   Y    
Danial   X    
Saeed   Y    
    X    

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 01: Introduction CS221 Data Structures & Algo.

Arrays

  Sale    

Item 1 2 8 85

Item 2 5 8 5

Item 3 5 8 5 Two Dimensional Arrays

Item 4 4 8 5

Item 5 5 5 5

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 01: Introduction CS221 Data Structures & Algo.

Arrays

Customer Salesperson
1 Jamal Tony
2 Sana Tony
3 Saeed Nadia
4 Farooq Owais
5 Salman Owais
6 Danial Nadia

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 01: Introduction CS221 Data Structures & Algo.

Link List
Jamal 1      
         
         
         
Sana 1      
         
         
         
         
    Saeed 2  
         
Farooq 3      
         

Salman 3   Salman 3

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 01: Introduction CS221 Data Structures & Algo.

Trees

Employee

Name Age Address Salary

First N Last N Street Area

City Province Post Code

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 01: Introduction CS221 Data Structures & Algo.

Trees
(2x+y)(a-7b)3

+ ^

* y - 3

2 x a *

7 b

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 01: Introduction CS221 Data Structures & Algo.

Stacks

2132

123

123

123

123
IN
123

123
OUT
546

45

543

2544

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 01: Introduction CS221 Data Structures & Algo.

Queue

2132

123

123

123
IN
123

123
OUT
3

2544

33

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 01: Introduction CS221 Data Structures & Algo.

The Need for 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.)

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi


Lecture 01: Introduction CS221 Data Structures & Algo.

Data Structure Operations


• Insertion
• Deletion
• Update
• Searching
Dictionary Operations

• Sorting
• Merging

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi

You might also like