DSA Lec 1 Spring 2022
DSA Lec 1 Spring 2022
Understanding of fundamental Data Structures including linked-lists, trees, binary search trees, AVL trees, stacks,
queues, priority queues, and hash-tables and skip lists.
Understanding of fundamental abstract data types which can include: Maps, Sets and Vectors.
Ability to program data structures and use them in implementations of abstract data types.
Ability to devise novel solutions to small scale programming challenges involving data structures and recursion.
Understanding of basic algorithmic complexity.
Ability to estimate the algorithmic complexity of simple, non-recursive programs
Ability to perform simple inductive proofs and proofs by contradiction and reason about program correctness
and invariants.
Ability to sensibly select appropriate data structures and algorithms for problems and to justify that choice.
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 2
LEARNING ACTIVITIES
Lectures
The lecture schedule is on the subject web page; students are encouraged to attend lectures as material presented in lectures often
includes more than is on the slides. Copies of the slides will be available via the subject web page, but you are strongly urged to take
proper lecture notes.
Work at Home
The best thing about the course is you don’t need any specialized hardware. So you can learn it by practicing the programming language
along the techniques and algorithms discussed in the class. If the concept is clear you will easily solve the challenging problems.
Practical Work
The practical work is critically important in this course. The practical's will happen weekly - there will be a total of eight (16) practical's.
Class Activities
Most of the time I engage students in class activities. These activities may be in small groups or can be perform individuals. Students
participating in these activities learn quickly than those who quit these activities.
Course Project
Each student must submit his file with the programs he has learned throughout the course and the special one project based on some
problem and its outcome
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 3
MAJOR PARTS IN DATA STRUCTURES AND ALGORITHMS COURSE
Array,
Stack,
Data Algorithm Record String Trees and Graph Greedy
Queue and Linked List
Structures Analysis and Processing Graphs Algorithms Algorithms
Recursion
Pointers
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 4
DETAILED COURSE OUTLINE (FOUNDATION)
String Processing Basic terminology, string operation, word processing string and pattern matching.
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 5
DETAILED COURSE OUTLINE (INTERMEDIATE)
Linear array, linear array in memory, traversing, searching, binary search, bubble
Array, Record & Pointers sort, insertion sort, selection sort, pointers array, multidimensional array, record
structure, matrix and sparse matrix.
Stack, Queue and Recursion Stack, operations of stack, recursion, quicksort, queue, queue operations,
priority queue and merge sort.
Node structure, linked lists in memory, array and linked lists, garbage
Linked List collection in linked lists, insertion, deletion, searching, circular linked lists and
header linked lists.
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 6
DETAILED COURSE OUTLINE (ADVANCED)
Greedy Algorithms Minimum spanning tree, Union find, Set cover, Huffman coding
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 7
ALGORITHMS EVERY PROGRAMMER MUST KNOW
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 8
IMPLEMENTATION OF DATA STRUCTURES
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 9
RECOMMENDED PROGRAMMING LANGUAGES
Java API provides built-in support for common Data Structures for writing programs like an array,
linked list, map, set, stack, and queue. These Data Structures need not be implemented manually,
but can directly be used them in programs.
Python is a programming language that has basic Data Structures such as Floats, Integers, Strings,
and Booleans. It also has non-primitive Data Structures such as lists, tuples, dictionaries, and sets.
Non-primitive Data Structures store a collection of values in various formats rather than
containing a single value.
In a programming language like C#, Data Structures like linked lists, stacks and queues, binary
search trees, heap, searching and hashing are ideally used and implemented. Here, Struct is a value
type data type that represents Data Structures.
C++ creates high-performance applications and provides a high level of control over computing
resources. The four common Data Structures that are implemented by this programming language
are- Arrays, Linked Lists, Stacks, and Queues.
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 10
MOST IN-DEMAND PROGRAMMING LANGUAGES 2022
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 11
FEATURES OF JAVA PROGRAMMING LANGUAGE
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 12
DATA STRUCTURES & ALGORITHM BOOKS IN JAVA
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 13
DATA STRUCTURES & ALGORITHM BOOKS IN PYTHON
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 14
DATA STRUCTURE IS ALL ABOUT…
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 15
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 16
WORLD NEED FAST AND RELIABLE SOLUTIONS EVERY SECOND
Search Engines
GPS navigation
Self-Driving Cars
E-commerce
Banking 1. The ACM-ICPC International Collegiate Programming Contest
Medical diagnosis 2. TopCoder
3. Google’s Coding Competitions
Robotics 4. The ICFP Programming Contest
5. BME International 24-hours Programming Contest
Algorithmic trading 6. The International Obfuscated C Code Contest
7. Internet Problem Solving Contest
and so on … 8. Microsoft Imagine Cup
9. Hewlett Packard Enterprise (HPE) Codewars
10. OpenChallenge
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 17
WHAT YOU EXPECT ? WHAT YOU OBSERVE?......
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 18
DATA STRUCTURES
Data structure is a storage that is used to store and organize data. It is a way of arranging data
on a computer so that it can be accessed and updated efficiently. Depending on your requirement and
project, it is important to choose the right data structure for your project.
Data type is a way to classify various types of data such as integer, string, etc. which determines the
values that can be used with the corresponding type of data, the type of operations that can be
performed on the corresponding type of data. There are two data types:
Built-in Data Type
Derived Data Type
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 19
BUILT-IN- DATA TYPE
Those data types for which a language has built-in support are known as Built-in Data types. For example, most of
the languages provide the following built-in data types.
Integers
Boolean (true, false)
Floating (Decimal numbers)
Character and Strings
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 20
DERIVED DATA TYPE
Those data types which are implementation independent as they can be implemented in one or the other way are
known as derived data types. These data types are normally built by the combination of primary or built-in data
types and associated operations on them. For example −
List
Array
Stack
Queue
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 21
DATA TYPES IN JAVA
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 22
DATA TYPES IN C / C++
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 23
TYPES OF DATA TYPES
Types of Data Types
Non-
Primitive
Primitive
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 24
DATA TYPES IN PYTHON
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 25
OPERATIONS ON DATA
The data in the data structures are processed by certain operations. The particular data structure chosen largely
depends on the frequency of the operation that needs to be performed on the data structure.
Traversing
Searching
Insertion
Deletion
Sorting
Merging
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 26
TYPES OF DATA STRUCTURES
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 27
ARRAY (LINEAR DATA)
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 28
QUEUE AND LINKED LIST
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 29
TREES IN DATA STRUCTURES
Tree
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 30
TYPES OF GRAPHS IN DATA STRUCTURES
Graphs
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 31
JAVA PRIMITIVE DATA TYPES
integer
RESERVED WORDS IN JAVA
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 33
LETS START THE COURSE WITH JAVA PROGRAMMING
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 34
JAVA VIRTUAL MACHINE ARCHITECTURE AND STRUCTURE
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 35
CODING STYLE IN JAVA
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 36
SIMPLE JAVA CODING FOR DATA TYPES
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 37
PROGRAMMING TIPS IN THIS BOOK
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 38
CREATING A PROGRAM
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 39
INTEGRATED DEVELOPMENT ENVIRONMENTS
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 40
COMPILING A JAVA PROGRAM INTO BYTECODE
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 41
LOADING A PROGRAM INTO MEMORY
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 42
BYTECODE VERIFICATION
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 43
EXECUTION
Phase 5: Execution
In phase 5, the JVM executes the program’s bytecodes, thus performing the actions specified by the
program (Fig) in early Java versions, the JVM was simply an interpreter for Java bytecodes. Most Java
programs would execute slowly , because the JVM would interpreter and execute slowly, because the JVM
would interpret and execute one bytecode at a time.
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 44
GET ONLINE CERTIFICATION FROM COURSERA
Enroll for free, course has been started from March 21, 2022.
https://www.coursera.org/specializations/data-structures-
algorithms?action=enroll
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 45
ASSIGNMENT # 1
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 46
END OF LECTURE
COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 47