Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

DAYANANDA SAGAR COLLEGE OF ENGINEERING

An Autonomous Institute Affiliated to VTU, Belagavi Approved by AICTE; ISO 9001:2015


Certified Accredited by National Assessment Accreditation Council (NAAC) with ‘A’ grade
Shavige Malleshwara Hills, Kumaraswamy Layout, Bengaluru-560078

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING


COURSE HANDOUT
Academic Year 2024-2025 L: T: P: S: 3:0:0:0
Course Title Design & Analysis of Algorithms Course code 22CS42
Credit Units 03 Course Type PCC
Course Author Prof. A M Prasad & Prof. Aruna S
Exam Hours 03 CIE Marks 50
Total Hours: 40 SEE Marks 50
Course objectives:
1. Understand algorithmic paradigms and their application in problem-solving.
2. Analyze the efficiency of algorithms using time and space complexity analysis.
3. Master algorithm design techniques including dynamic programming, divide and conquer, and greedy
algorithms.
4. Develop problem-solving skills through implementation, critical analysis, and real-world applications.
Course Outcomes [CO]: Upon completion of this course, student will be able to:
CO1 Understand the correctness of algorithms using inductive proofs and analyze running times of algorithms
using asymptotic analysis.
CO2 apply different algorithmic paradigms to real time problems.
CO3 compare between different data structures and pick an appropriate data structure for a design situation.
CO4 describe the classes P, NP, and NP complete and be able to prove that a certain problem is NP-Complete.
CO5 create most efficient algorithm for the new problems among many possible solutions.

CO-PO Articulation Matrix using Contact Hours Method


Course Outcomes POs / PSOs # of Theory hours
CO1 PO1, PO2, PO3, 08
CO2 PO2, PO3, ,PSO01 12
CO3 PO2, PO3, PSO02,PSO03 08
CO4 PO3, PO8 06
CO5 PO3, PO4, PO8, PO9,P10, PSOO3 06
Total Contact Hours 40
POs/PSOs COs # of Theory hours
PO1 CO1 08
PO2 CO1, CO2, CO3 08+12+08 = 28
PO3 CO1, CO2, CO3, CO4, CO5 08+12+08+06+06 = 40
PO4 CO2, CO3, CO5 12+08+06 = 26
PO8 CO5 = 06
PO9 CO5 = 06
PO10 CO5 = 06
PSO1 CO2 = 12
PSO2 CO3 = 08
PSO3 CO3, CO5 08+06 = 14

Mapping Strength

Number of Sessions Assigned / Allotted % PO / PSO Mapping Strength


08 out of 40 20 PO1 1
28 out of 40 70 PO2 3
40 out of 40 100 PO3 3
26 out of 40 65 PO4 2
40 out of 40 100 PO8 1
40 out of 40 100 PO9 1
40 out of 40 100 PO10 1
12 out of 40 30 PSO1 2
08 out of 40 20 PSO2 1
14 out of 40 35 PSO3 2

CO, PO and PSO Mapping


PO- PO- PO- PO- PO- PO- PO- PO-08 PO-09 PO- PO- PO- PSO PSO2 PSO3
01 02 03 04 05 06 07 10 11 12 1
CO1 1 3 3 - - - - - - - - - - - -
CO2 - 3 3 - - - - - - - - - 2 - -
CO3 - 3 3 - - - - - - - - - - 1 1
CO4 - - 3 - - - - - - - - - - - -
CO5 - - 3 2 - - - 1 1 1 - - - - 1
AV 1 3 3 2 - - - 1 1 1 - - 2 1 1
G

Unit Contents Hours COs


Unit – 1 Introduction: What is an algorithm? Analysis of Algorithm Efficiency: The Analysis 08
Framework, Asymptotic and Basic Efficiency Classes, Mathematical Analysis of Non-
recursive, Algorithms Mathematical Analysis of Recursive Algorithms. Brute Force
Method: Introduction, Bubble sort, Selection sort, Linear search, depth-first search
(DFS) and breadth-first search (BFS). CO1
Hands-on: Sorting Algorithms, Searching algorithms. &
Case study: Closest-Pair and Convex-Hull Problems by Brute Force method. CO2

Unit - 2 Divide-And-Conquer: Introduction, Master theorem, Quick sort, Merge sort, 08


Multiplication of Large Integers and Stassen’s Matrix Multiplication. CO2
Decrease-and-conquer: Insertion Sort, Topological Sorting, Algorithms for Generating &
Combinatorial Objects. CO3
Hands-on: Divide and Conquer sorting algorithms, Topological Sorting:
Dependency Analysis, Event Management.
Case Study: The Closest-Pair and Convex-Hull Problems by Divide-and-Conquer.
Unit – 3 Space and Time Trade-Offs: Introduction, sorting by Counting, Input 08
Enhancement in Horspool String Matching. CO2
Dynamic Programming: Introduction, Warshall’s and Floyd’s Algorithms, Matrix- &
chain multiplication, Longest common subsequence, CO3
Edit Distance (Levenshtein Distance).
Hands-on: String matching algorithm, programs based on dynamic programming
strategy.
Case Study: Three Basic Examples of Dynamic programming, Coin-
Row problem, Change-making problem, Coin-collecting problem.

Unit – 4 Greedy Technique: Introduction, Prim’s Algorithm, Kruskal’s Algorithm, Dijkstra’s 08


Algorithm, Bellman – Ford Algorithm, Huffman code, Activity Selection Problem
Maximum Flow: Flow networks, the Ford-Fulkerson method. CO2
Hands-on: Implementation of Minimum spanning tree algorithms, single source CO3
shortest path algorithms.
Case Study: Shortest-path modeling. &
CO4
Unit - 5 Limitations of Algorithm Power: Lower-Bound Arguments, Decision Trees, P, NP, 08
and NP-Complete Problems.
Coping with the Limitations of Algorithm Power: Backtracking: n-Queens CO3
Problem, Subset-Sum Problem Branch-and-Bound: Assignment Problem, Knapsack CO4
Problem, Traveling Salesman Problem. &
Hands-on: Implementation of backtracking algorithms. CO5
Case Study: Hamiltonian circuit problem.

Text Books:
Sl.# Author & Edition Publisher
Introduction to the Design and Analysis of Algorithms, Anany Levitin, Third
1. Pearson, 2011.
Edition.
Introduction to Algorithms, Thomas H Cormen, Charles E Leiserson, Ronald
2. MIT Press, 2009
L Rivest, Clifford Stein, Third Edition.

Reference Books:
Sl.# Author & Edition Publisher
Fundamentals of Computer Algorithms, Ellis Horowitz, Satraj Sahni and University Press Pvt. Ltd,
1.
Rajasekharam,2nd Edition. 2009.
Sri Nandi Publications,
2. Analysis and design of Algorithms, Padma Reddy,
2009.

Web Resources/Online Course:


1. https://online.stanford.edu/courses/soe-ycsalgorithms1-algorithms-design-and-analysis-part-1 [ Register for free ]
2. Analysis of Algorithms:
https://infyspringboard.onwingspan.com/web/en/app/toc/lex_auth_012892025621782528104_shared/overview [
Register for free , 3h 25m ]
3. https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-006-introduction-toalgorithms-spring-
2008/lecture-notes/
4. https://www2.cs.duke.edu/courses/fall10/cps130/lectures.html
5. https://www.isical.ac.in/~arijit/courses/spring2017/daa-mtech.html
6. http://www.cs.umd.edu/class/fall2015/cmsc451/
7. http://www.cse.iitd.ernet.in/~ssen/csl356/admin356.html
8. https://www.cs.virginia.edu/~luebke/cs332/
9. https://www.cs.umd.edu/users/samir/

Self-Study Component:
Reference Books: Introduction to Algorithms, Thomas H. Cormen, Charles E. Leiserson Ronald L. Rivest
Clifford Stein, 4th edition, MIT Press.
Unit Prerequisite Topic Reference link
[ Studied in syllabus ] (Self-Study)
Unit – 1 Analysis of Recursive Solving recurrences https://web.stanford.edu/class/archive
Algorithms /cs/cs161/cs161.1168/lecture3.pdf
Unit – 2 Divide-And- Probabilistic Analysis & https://web.stanford.edu/class/archiv
Conquer Randomized Algorithms e/cs/cs161/cs161.1168/lecture6.pdf
Unit – 3 Rod cutting problem https://web.stanford.edu/class/archive/
Dynamic Programming
cs/cs161/cs161.1168/lecture12.pdf
Unit – 4 Greedy Method Johnson’s algorithm for sparse https://www.geeksforgeeks.org/johnso
graphs ns-algorithm/
Unit - 5 Approximation The set-covering problem https://math.mit.edu/~goemans/18434
Algorithms S06/setcover-tamara.pdf

Assignment Scheme [Certification]

# Topics Link Marks Total


a. https://infyspringboard.onwingspan.com/web/en/app/toc/lex_auth_
Sorting Algorithms 05
0135015631086632969071/overview
b. Implementing Graph https://infyspringboard.onwingspan.com/web/en/app/toc/lex_auth_ 10
Traversal & Shortest Path 01350158597460787212404/overview 05
Algorithms

Alternative Assignment Tool [Quiz, online mode]

Unit Number of Multiple choice questions Marks Total


Unit – 1 06 06 Scale down to 10
Unit – 2 06 06
Unit – 3 06 06
10
Unit – 4 06 06
Unit - 5 06 06

Continuous Internal Assessment

CIA # Marks Portions


CIA 1 30 Unit – 1 , Unit – 2
CIA 2 30 Unit – 3, Unit – 4
CIA 3 30 Unit – 5
Evaluation Scheme [Integrated]
1. Theory
Sl.no Particulars Max. Marks Scale down to 10 Max. Marks
a. Continues Internal Assessment -1 30
Average of 03
b. Continues Internal Assessment -2 30 30[ Min 12 ]
Assessments
c. Continues Internal Assessment -3 30
d. Assignment [ Problem Based ] 10 10 10
e. Alternative Assessment 30 10 10
Total 50
DAYANANDA SAGAR COLLEGE OF ENGINEERING
An Autonomous Institute Affiliated to VTU, Belagavi Approved by AICTE; ISO 9001:2015
Certified Accredited by National Assessment Accreditation Council (NAAC) with ‘A’ grade
Shavige Malleshwara Hills, Kumaraswamy Layout, Bengaluru-560078

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING


Design and Analysis of Algorithms Laboratory.
Academic Year 2024-2025 L: T: P: S: 0:0:2:0
Course Title Design & Analysis of Algorithms Lab Course code 22CSL45
Credit Units 01 Course Type PCCL
Course Author Prof. A M Prasad & Prof. Aruna S Date Approved 16/02/2024
Exam Hours 03 CIE Marks 50
Total Hours: 12 Labs [ 24 Hours ] SEE Marks 50

Course Outcomes: At the end of the laboratory course, student will be able to:

CO1 apply and implement major algorithm design techniques to solve problems
CO2 analyze time complexity of those problems.
CO3 demonstrate familiarity with major algorithms and the related data structures.

# Problem statement Hours COs


1 Develop the logic using Quick sort strategy and implement the program to sort a given
set of elements and determine the time required to sort the elements. Repeat the
experiment for different values of n, the number of elements in the list to be sorted and 02
plot a graph for the time taken versus n. The elements should be read from a file/can be
generated using the random number generator.
2 Develop the logic using Merge sort strategy and implement the program to sort a given
set of elements and determine the time required to sort the elements. Repeat the
experiment for different values of n, the number of elements in the list to be sorted and 02
plot a graph for the time taken versus n. The elements should be read from a file/can be
generated using the random number generator.
3 Write and execute a menu driven program to print all the nodes reachable from a given
starting node in a graph using DFS and BFS method. 02
4 Write and execute a menu driven program to print all the nodes reachable from a given
starting node in a graph to arrange nodes in topological order using DFS method and 02
source removal technique.
5 Develop the logic using Horspool String Matching algorithm to implement a program to
search for the given pattern in given text string. 02
6 Write and execute a program for matrix chain multiplication for the given sequence of
Matrices { A1, A2 . . . . . An}. 02
7 Write and execute a program to find a longest-common-subsequence of
X and Y using dynamic programming for given two sequences X = {x1, 02
x2 . . . . . xm }; Y = {y1 y2 . . . . .yn}
8 Write and execute a program to find Minimum Spanning Tree using 02
Prim’s method.
9 Write and execute a program to find Minimum Spanning Tree using
Kruskal’s method. 02
11 Write and execute a program to find shortest path to all other nodes in weighted graph
using Dijkstra’s strategy. 02
10 Write and execute a program to find a subset of a given set S = {s1, s2 ,…..,sn } of n
positive integers whose sum is equal to a given positive integer d. For example, if S= {1,
2, 5, 6, 8} and d = 9 there are two solutions {1, 2, 6} and {1, 8}. A suitable message is to 02
be displayed if the given problem instance doesn’t have a solution
12 Write and execute a program to find solution to n- queens problem 02

Text Books:
Sl.# Author & Edition Publisher
Introduction to the Design and Analysis of Algorithms, Anany Levitin, Third
1. Pearson, 2011.
Edition.
2. Ellis Horowitz, Sartaj Sahni, Sanguthevar Rajasekaran: Fundamentals of
2. Universities Press
Computer Algorithms, 2nd Edition.

Reference Books:
Sl.# Author & Edition Publisher
Thomas H. Cormen, Charles E. Leiserson, Ronal L. Rivest, Clifford Stein:
1. PHI, 2010
Introduction to Algorithms, 3rd Edition.
Sri Nandi Publications,
2. Analysis and design of Algorithms, Padma Reddy
2009.

Scenario based Problems


# Problem statement
1 A lady wins a sales promotion campaign of a grocery store and the store allows her to enter the store during a
specified time and fill an empty cart of 20 kg with 6 items of her choice absolutely free. The only condition
applicable is that the weight of the filled cart with items cannot exceed 120 kg. As per her household needs,
the lady considers a subset of items (Wheat, Sugar, Tea, Coffee, Rice and Salt) among the available items in
the store. These items are available only in the packs of {100, 50, 45, 20, 10, 5} kg respectively and the price
of these packs are {40, 35, 18, 4, 10, 2} rupees respectively. Packs can be opened to take the required amount.
Help the lady using a Greedy Approach to maximize her selection from financial perspective. Hint: Knapsack
Problem.
2 A robotic arm performs the drill on a metal plate starting from the source point (N) to all other points. The
input to the arm is given in the form of adjacency matrix shown in the table-1. Using Dijkstra's Algorithm find
out the shortest distance to all points starting from the source. (H = ∞)

3 A city municipal corporation has to dig the sewerage line connecting all the points as shown and marked A to
F in Figure. The distances between the points are also mentioned. Using Kruskal's Algorithm and showing all
the intermediate steps find out the best possible connectivity layout for the sewerage line.

4 Popular Engineering Text Book publisher TATA MCGRAW HILL making the promotion of the new text
book. The Head of the TATA MCGRAW HILL A publisher instructs the salesperson to go to TATA
MCGRAW HILL head office collect five text books and travel to all cities and do marketing for the book and
come back to head office and report. Suggest the method to find at least one path to complete his tour. Hint:
Hamiltonian Cycles.

5 Popular Technical University in Bangalore gives the advertisement for the post of FOUR Visiting professors
four subjects. The rule of the university is each professor must get one subject to teach. It is also required the
each professor has to quote required remuneration for the subject. The details are given in below table. You
being the expert problem solver provide the solution. Hint: Assignment problem.

6 The BBMP has decided to put toll on the roads in the city to reduce traffic congestion with different strategy.
The positive weight on the edge indicates the money is deducted from the traveler wallet and negative weight
on the edge indicates the money is credited to the traveler wallet. You are required to find the path so that the
traveler reaches the destination with minimum toll from source “1”. Hint: Bellman Ford Algorithm.

7 Navigation systems such as the Google Maps, which can give directions to reach from one place to another,
take your location to be the source node and your destination as the destination node on the graph. Graph
traversal methods are used to find if the destination entered can be reachable or not. Hint: Graph Traversal
Algorithm.
Hint: Any city can be represented as a graph taking landmarks as nodes and roads as edges. Using an
appropriate technique check if your desired destination is reachable or not considering
8 Spam (Unsolicited and unwanted emails) is annoying, no doubt, but it can also be dangerous. Malware and
phishing are hugely profitable for scammers and can be costly for mailbox providers’ customers, as well as
the mailbox providers who face intense market competition.
To avoid such problem mailbox providers’ use Spam filters. All spam filters use the concept of string matching
to identify and discard the spam.
Considering the above scenario use an appropriate technique to classify the mails if it’s a spam or not when
there are patterns like “free,” “money,” “help” and “prize” in the mail content. Hint: String Matching
Algorithm.
9 DNA-based identity testing is extensively used in the forensic field. DNA sequences can be viewed as strings
of A, C, G, and T characters, which represent nucleotides. To compare and analyze two such strings, the
longest subsequence is necessary. With an appropriate approach print the longest subsequence for two DNA
sequences. Hint: Longest common subsequence strategy.
10 Laying out electrical networks to be carried in a city that minimizes the total cost of the wiring. Choose
appropriate design strategy to connect all the houses so that wiring cost is minimum. Given: Layout input as a
graph with the distances. Nodes 1,2,3,4 and 5 represent homes and the edges with cost gives the wiring cost
between the homes. Hint: Minimum Spanning Tree Algorithm.
11 In the Google map, the navigation system always shows the shortest path to travel from source to destination.
State can be represented as a weighted graph by taking districts as nodes and roads as the edges that connects
the districts. Hint: Dijkstra’s algorithms
Considering the above scenario, apply single source shortest path method to find the shortest distance between
two districts for the graph.
12 In an Education institution, there are faculties with varied number of teaching experience. For an upcoming
semester Computer Science department requires a team of faculty with combined experience of 9 years to
form a syllabus for Data Science course. Hint: Sum of Subset problem.
Consider the table below with information about the teaching experience of Computer Science faculty. Apply
an appropriate backtracking technique to solve the above scenario.
Sl.No Faculty Teaching Experience
1 Mr. John 1 yrs
2 Mr. Jacob 2 yrs
3 Mr. Dave 3 yrs
4 Mrs. Emily 6 yrs
5 Mrs. Ava 7 yrs
6 Ms. Jessica 8 yrs

You might also like