0% found this document useful (0 votes)
14 views47 pages

DSA Lec 1 Spring 2022

The document discusses an introduction to a course on data structures and algorithms. It covers topics like course learning outcomes, major parts of the course, detailed course outlines, recommended programming languages, and important algorithms. Data structures and algorithms are important for developing fast and reliable solutions.

Uploaded by

Mehmood Sheikh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views47 pages

DSA Lec 1 Spring 2022

The document discusses an introduction to a course on data structures and algorithms. It covers topics like course learning outcomes, major parts of the course, detailed course outlines, recommended programming languages, and important algorithms. Data structures and algorithms are important for developing fast and reliable solutions.

Uploaded by

Mehmood Sheikh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 47

CS211 – DATA STRUCTURES AND ALGORITHMS

LECTURE 1: INTRODUCTION TO THE COURSE AND JAVA PROGRAMMING

Asst. Prof. Syed Faisal Ali


[email protected]
Computer Science
(Software Engineering)
Sec A
SPRING 2022
COURSE LEARNING OUTCOMES

 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)

Introduction to data structures, organizing of data in data structure and


Data Structures
data structures operations.

Induction, Recurrence relations, Big-Oh and little-Oh notation, Merge sort,


Algorithm Analysis
Bubble sort, Heap sort, Radix sort, Insert sort, etc.

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)

Trees structure, n-tree, binary tree, binary tree in memory, traversing in


Trees and Graphs binary tree, binary search tree (BST), insertion in BST, deletion in BST,
graph theory, adjacency matrix and Warshall’s algorithm.

Depth-first search, strongly connected components, Breadth-


Graph Algorithms
first search, Dijkstra's algorithm

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

Boolean Numeric String Array Structure Classes etc

Boolean Character Integral

Char Integer Floating Point

Byte Short Int Long Float Double

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

Binary Search Expression


General Tree Forest Binary Tree
Tree Tree

COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 30
TYPES OF GRAPHS IN DATA STRUCTURES

Graphs

Undirected Directed Unweighted Weighted

COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 31
JAVA PRIMITIVE DATA TYPES

Type Values Default Size Range


byte signed integers 0 8 bits -128 to 127
short signed integers 0 16 bits -32768 to 32767
int signed integers 0 32 bits -2147483648 to 2147483647
long signed integers 0 64 bits -9223372036854775808 to
9223372036854775807
float IEEE 754 floating point 0.0 32 bits +/- 1.4 E-45 to
+/- 3.4028235 E+38 , NAN
double IEEE 754 floating point 0.0 64 bits +/- 4.9 E-324 to
+/- 1.797693 E +308, NAN
char Unicode character \u0000 16 bits \u0000 to \uFFFF
boolean
COPY RIGHT: ASST. PROFtrue, false
SYED FAISAL ALI false 1 bit is used in 32 bit N/ATuesday, March 22, 2022 32

integer
RESERVED WORDS IN JAVA

COPY RIGHT: ASST. PROF SYED FAISAL ALI Tuesday, March 22, 2022 33
LETS START THE COURSE WITH JAVA PROGRAMMING

 The books is written for beginner programmer who loves to do


coding with the tips according to the Software Engineering.
 So for the ease I will follow this book for the Java programming
and others when required.
 Most of the time for the learning perspective I will give the
exercises and problems from this book.

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

 Read the material discussed in class today.


 Download the books from the MS TEAM class.
 Install Eclipse , JDK, JRE and Python Environment using ANACONDA and 3.8 or 3.9 python version.
 Read the first chapter of any JAVA programming book that has been given to you and understand what it requires
you to start coding.
 For the ease 3 videos have been uploaded regarding JAVA programming.
 Select Java Tutorials for Beginners (2022). Java FULL Course in 11 hours.
 Start coding and finished the video before next Tuesday and submit the solutions on MS Team class.

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

You might also like