Data Structures and Algorithms
Data Structures and Algorithms
I
T
2
0
8 Lecture 1
1 Dr. Belal Murshed
Data Structures and Algorithms
I
T
2 Course Introduction
0
8
2 Dr. Belal Murshed
Data Structures and Algorithms
Course Contents
Introduction to Data Structures
I Static Data Structures
T Stacks and Queues
2 Dynamic Data Structures
0 Implementing Stack with Single Linked List
8 Implementing Queue with Single Linked List
Recursion
3 Dr. Belal Murshed
Data Structures and Algorithms
I
T
2
Course Learning
0 Outcomes (CLOs)
8
4 Dr. Belal Murshed
Data Structures and Algorithms
Course Learning Outcomes (CLO)
Differentiate between static and dynamic data structures. Determine the
tradeoffs between different data structures and identify applications of them.
I
Design and analyze more efficient algorithms for solving basic problems.
T
2 Comprehend and trace the output of a given piece of code or algorithm.
0 Demonstrate linear and binary search techniques in problem solving.
8 Represent and implement linked data structures.
Apply different operations, including search, insertion, and deletion, on linked
lists.
5 Dr. Belal Murshed
Data Structures and Algorithms
Course Learning Outcomes (CLO)
Apply recursion in solving simple problems.
I
Implement stacks using arrays and linked lists.
T
2 Implement queues using arrays and linked lists.
0 Describe and represent different tree terminologies.
8 Apply different operations, including search, insertion, and deletion, on
trees and binary search trees.
Comprehend, compare, and apply sorting algorithms in problem solving.
6 Dr. Belal Murshed
Data Structures and Algorithms
Course Learning Outcomes (CLO)
Evaluate and Analyze the running time of small algorithms in
terms of the number of operations performed
I
T Experiment and practice recursive sorting algorithms in
problem solving
2 Describe, represent, and apply hash table terminologies and
operations.
0
Describe, represent, and apply heap (priority queue)
8 terminologies and operations.
Develop small-scaled programming assignments in C++, taking
space and time efficiency into account.
7 Dr. Belal Murshed
Data Structures and Algorithms
I
Goals
T
2
Data Structure and
0 Algorithms
8
8 Dr. Belal Murshed
Data Structures and Algorithms
Goals
Improve knowledge of standard data structures and
abstract data types
I
Improve knowledge of standard algorithms used to
T solve several classical problems
2 Cover some mathematical concepts that are useful for
the analysis of algorithms
0
Analyze the efficiency of solutions to problems
8
Learn about and be comfortable with recursion
9 Dr. Belal Murshed
Data Structures and Algorithms
Assessments
Assessment Marks Grading Percentage
Assignments (4)
I 20 13.33%
Quizzes 10 6.67%
T
Midterm(practical) 10 6.67%
2
Midterm(Theory) 20 13.33%
0
Final Exam
20 13.33%
8 (practical)
Attendance and sharing 10 6.67%
Final Exam(Theory) 60 40%
10 Total 150 100% Dr. Belal Murshed
Data Structures and Algorithms
Teaching Method
• This class is NOT used to teach you C++
I • Majority of this class is used covering new data
structures, abstract data types, and algorithm
T analysis
2 • The teaching of these concepts dictate more
explanation and less of a focus on “code”
0 o Some code will be shown on the PowerPoint slides
• Such as after we explain a new abstract data type
• We’ll show the code of how you would implement it
8 o However, writing of actual code will most likely never
be done in class
• Again, that is not the purpose of this class
11 Dr. Belal Murshed
Data Structures and Algorithms
I
T
Introduction to Data
2 Structure
0
8
12 Dr. Belal Murshed
Data Structures and Algorithms
What is Data?
• Data
o A collection of raw facts from which a conclusion may be drawn.
I o A collection of letters, symbols, numbers, and text (unorganized,
unprocessed data)
T o Example:
• Temperature is 35 degrees celcius
2 • Conclusion: It is HOT!
• Types of data:
0 o Textual: for example
» Your name (Muhammad)
8 o Numeric: for example
» Your id (090254)
o Audio: for example,
» Your voice
13 Dr. Belal Murshed
Data Structures and Algorithms
What are Data Type?
• Data Type:
I oBuilt-in construct of any programming
T language to manipulate “basic types of data”
2 oBasic Types of Data
• Character
0 • Integer
8 • Real or Floating point number
oExample (Data Type):
• Short,int, long, char,double etc ;
14 Dr. Belal Murshed
Data Structures and Algorithms
What are Data Structures?
• Data Structure:
I oA particular way of storing and organizing data
T in a computer so that it can be used efficiently
2 oIt is a group of data elements stored together
under one name
0 oIt is also referred as “Abstract Data Type (ADT)”
8 oExample:
• An array of integers
int examGrades[30];
15 Dr. Belal Murshed
Data Structures and Algorithms
I
T
2
0
8
Data Structures
16 Dr. Belal Murshed
Data Structures and Algorithms
Importance of Data Structures
• Goal:
I oWe need to organize data
T • For what purpose?
oTo facilitate efficient
2 • storage of data
• retrieval of data
0 • manipulation of data
• Design Issue:
8 oThe challenge is to select the most appropriate
data structure for the problem
• Such is one of the motivations for this course
17 Dr. Belal Murshed
Data Structures and Algorithms
List of Data Structures
• Arrays
I
• Linked List
T
• Stacks • Queues • Trees
2
0
8
• Graph
18 Dr. Belal Murshed
Data Structures and Algorithms
Classification of Data Structures
• Based on Existence:
I oPhysical data structures
T • Can be created independently
o Array
2 o Linked List
0
8 oLogical data structures
• Can’t be created independently
o All others e.g.
o stack, queues, trees, graphs
19 Dr. Belal Murshed
Data Structures and Algorithms
Classification of Data Structures
• Based on Memory Allocation:
I oStatic (or fixed sized) data structures
T • Such as arrays
2
oDynamic data structures (change size as
0 needed)
8 • Such as Linked Lists
20 Dr. Belal Murshed
Data Structures and Algorithms
Classification of Data Structures
• Based on Representation
I oLinear representation data structures
T • Arrays
• Linked lists
2
• Stack
0 • Queues
8 oNon-linear representation data structures
• Trees
• Graphs
21 Dr. Belal Murshed
Data Structures and Algorithms
Operations on Data Structures
• Traversing
I oAccessing/visiting each data element exactly
T once so that certain items in the data may be
processed
2 • Searching
0 oFinding the location of a given data element
(key) in the structure
8
• Insertion:
oAdding a new data element to the structure
22 Dr. Belal Murshed
Data Structures and Algorithms
Operations on Data Structures
• Deletion
I oRemoving a data element from the structure
T • Sorting
2 oArrange the data elements in some logical
fashion
0 • ascending or descending
8 • Merging
oCombining data elements form two or more
data structures into one
23 Dr. Belal Murshed
Data Structures and Algorithms
Reference Book
I
T 1. D.S. Malik, (2010). "Data Structures Using C++", 2nd
Edition (or Higher), USA, Course Technology, Cengage
2 Learning.
0 2. D.S. Malik, (2018). " C++ programing: program design
including Data Structures" 8th Edition, USA, Course
8 Technology, Cengage Learning
24 Dr. Belal Murshed
Data Structures and Algorithms
I
T
2
0
8
25 Dr. Belal Murshed