CSE 408:DESIGN
AND ANALYSIS OF
ALGORITHMS
Lecture: 0
Course Details
1. LTP – 3 0 0 [Three lectures
/week]
2. Text Book
INTRODUCTION TO THE
DESIGN AND ANALYSIS
OF ALGORITHM
by ANANY LEVITIN,PEARSON
Marks Breakup:
Activity Marks
Attendance 5
Continuous Assessment (CA)* 25
Mid-Term Examination (MTE) 20
End-Term Examination (ETE) 50
Total 100
* 2 Best CA out of 3 CA (Class test, MCQ).
CA1 (Class Test) will be held on 4th Week
CA2 (Class Test) Will be held on 7th Week
CA3 (Class Test) Will be held on 11th Week
06/01/2022 CSE408, Lovely Professional University
Algorithms
Course Outcomes :
CO1 :: explain the basic techniques of analyzing the algorithms using space and
time complexity, asymptotic notations
CO2 :: analyse various string matching algorithms and understand brute force
algorithm design technique
CO3 :: understand divide and conquer algorithm design technique using
various searching and sorting algorithms
CO4 :: define dynamic programming and greedy algorithm design technique
and solve various all pair and single source shortest path problems
CO5 :: apply the backtracking method to solve some classic problems and
understand branch and bound algorithm design technique
CO6 :: define various number theory problems and understand the basics
concepts of complexity classes
Introduction
• The methods of algorithm design form one of the core
practical technologies of computer science.
• The main aim of this lecture is to familiarize the student with
the framework we shall use through the course about the
design and analysis of algoriTHM
Algorithms
• The word algorithm comes from the name of a Persian
mathematician Abu Ja’far Mohammed ibn-i Musa al
Khowarizmi.
• In computer science, this word refers to a special method
useable by a computer for solution of a problem. The
statement of the problem specifies in general terms the
desired input/output relationship.
• For example, sorting a given sequence of numbers- insertion
sort
The problem of sorting
Example of Insertion Sort
Example of Insertion Sort
Example of Insertion Sort
Example of Insertion Sort
Example of Insertion Sort
Example of Insertion Sort
Example of Insertion Sort
Example of Insertion Sort
Example of Insertion Sort
Example of Insertion Sort
Example of Insertion Sort
Machine-independent time: An example
A pseudocode for insertion sort ( INSERTION SORT ).
INSERTION-SORT(A)
for j 2 to length [A]
key A[ j]
i j–1
while i > 0 and A[i] > key
A[i+1] A[i]
ii–1
A[i +1] key
Analysis of algorithms
The theoretical study of computer-program
performance and resource usage.
What’s more important than performance?
• correctness
• maintainability
• user-friendliness
• programmer time
• simplicity
Analysis of algorithms
Why study algorithms and performance?
• Algorithms help us to understand scalability.
• Performance often draws the line between what is feasible and
what is impossible.
• Speed is fun!
Running Time
• Therunning time depends on the input: an already
sorted sequence is easier to sort.
• Parameterize the running time by the size of the input,
since short sequences are easier to sort than long ones.
Kinds of analyses
Worst-case: (usually)
• T(n) = maximum time of algorithm on any input of size n.
Average-case: (sometimes)
• T(n) = expected time of algorithm over all inputs of size n.
• Need assumption of statistical distribution of inputs.
Best-case:
• Cheat with a slow algorithm that works fast on some input.