1. Introduction 1
1. Introduction 1
1
About Me
• MS (CS)
• COMSAT University Islamabad (Lahore Campus)
• 2020-2022
• Research Officer
• AL-Khwarizmi Institute of Computer Science (KICS) UET
Lahore
• 2019-2023
• Lecturer 2 2
• Computer Science Department, SST
About Me
• Instructor: Hafiz Abdul Rehman
• Email: [email protected]
• Office: Room No 404, STD
• Google Scholar Profile: Hafiz Abdul Rehman
• GitHub Profile: Hafiz Abdul Rehman
• LinkedIn Profile: https://www.linkedin.com/in/ha-rehman/
3 3
About Me : Research Profile
4 4
Course Details
• Course Code: CC2042
• Assessment
• 25% Coursework
• 25% Midterm,
• 30% Final
• 20% Project
• Office Hours: 10:00am – 12:00pm or When Door Open
5 5
Textbooks - DSA
6
Pre Requisites - DSA
7
Course Outline
• Introduction to DSA
• Operations of Data Structures
• Types of Algorithms
• Arrays
• Dynamic Memory Allocation of Arrays
• Queue and Stack
• Searching and Sorting Algorithms
• Link List (Single, Double, and Circular)
• Operations of Data Structures
• Trees, Graphs 8 8
• Heap and Hashing
Data Structure
• A data structure is a fundamental concept in computer science
and programming that defines how data is organized, stored, and
manipulated in a computer's memory or storage.
• It provides a way to efficiently manage and access data, enabling
various operations and algorithms to be performed on that data.
• Data structures are essential for solving complex problems and
optimizing the use of computer resources.
• A data structure is a collection of basic data types combined
according to the rules of the programming language to create a
new user-defined data types. 9 9
Operations on Data Structures
The data in a data structure is processed using certain operations.
Inserting: Adding new data items into a data structure is called inserting.
Deleting: Removing new data items into a data structure is called
Deleting.
Searching: Finding specific data items in a data structure is called
Searching.
Traversing: Accessing each record or item in a data structure exactly once
for processing is called traversing. It is also called visiting.
Sorting: Arranging data items in a data structure into a specific order is
called sorting. 10 10
Merging: Combining two lists of data items into a single data list is called
merging.
Types of Data Structures
Data Structure
Trees Graphs
11 11
Primitive and Non-Primitive Data Types
Primitive Data Types
• Fundamental building blocks for representing simple values
• Built into the programming language itself
• Used to represent basic data, such as numbers, characters, and
Boolean values.
• Primitive data types are directly supported by the hardware.
• They have fixed sizes, which means they use a specific amount of
memory.
• E.g. Integer contain 4 bytes and Boolean Contain 1 bit.
12 12
Primitive and Non-Primitive Data Types
Non-Primitive Data Types
• Also known as reference data types
• Not store the actual data directly but instead store references
(memory addresses) to the data.
• Typically created by the programmer and are not fixed in size.
• Common examples of non-primitive data types include:
• Arrays: Ordered collections of elements of the same or different
data types.
• Objects: Instances of user-defined classes that can encapsulate data
and behavior. 13 13
17 17
Classification of Algorithms
• Recursion or Iteration: Calls itself repeatedly until a base condition
is satisfied
• Procedural: we have to specify the exact steps to get the result
• Declarative (non-Procedural): we say what we want without having
to say how to do it.
• Serial: execute one instruction at a time
• Parallel: process several instructions at a time.
• divide the problem into subproblem
• serve them to several processors or threads.
• Distributed: If the parallel algorithms are distributed to different
18 18
machines, then we call such algorithms distributed algorithms.
Classification of Algorithms
• Deterministic or Non-Deterministic: Deterministic algorithms solve
the problem with a predefined process, whereas non-deterministic
algorithms guess the best solution at each step through the use of
heuristics.
• Divide and Conquer
• Divide: Breaking the problem into subproblems that are themselves
smaller instances of the same type of problem.
• Recursion: Recursively solving these subproblems.
• Conquer: Appropriately combining their answers.
19 19
• Examples: merge sort and binary search algorithms.
Thank You
20