0% found this document useful (0 votes)
30 views8 pages

DAA Assignment 3

Uploaded by

fahad821alam
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)
30 views8 pages

DAA Assignment 3

Uploaded by

fahad821alam
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/ 8

CHANDIGARH UNIVERSITY

Gharuan, Mohali
Institute/Department: CSE
Division:BE
Subject Name: Design and Analysis of Algorithms
Subject Code: CST-302

Assignment No.: 3
Max. Marks: 12

Date of Allotment:15th Oct, 2019


Last date of Submission:25thth , Oct 2019

Course Outcomes:
CO Title Level
Number

CO1 Graph Algorithms Practice

CO2 Computational complexity Practice

CO3 Amortized analysis Practice

CO4 Miscellaneous topics Practice


Assignment 1:

Sr. Question CO
No. Number

1 Q1. What is all pair shortest path? Solve the problem for given graph CO1

2 CO2
Q2. Differentiate between BFS and DFS traversals
3 Q3. What is topological sort? Along with algorithm write the linear order for CO1
given graph

Assignment 2:

Sr. Question CO
No. Number

1 Q1. Differentiate between dijkstra’s algorithm and bellman ford algorithm. CO3

2 Q2:- A graph is having the following attributes: CO1

V= { A,B,C,D,E} and E={ A->B, B->B, B->C, D->A, E->C, C->D, A-


>E} Represent this graph with adjacency list and adjacency matrix.
3 Q3. Apply BFS and DFS on the graph with following attributes: V= { CO1

A,B,C,D,E} and E={ A->B, B->B, B->C, D->A, E->C, C->D, A->E}

Assignment 3:

Sr. Question CO
No. Number

1 Q1. Find the single source shortest path using Bellman Ford algorithm: CO1

2 Q2:-Find the single source shortest path using Dijkstra algorithm: CO1
Assignment 4:

Sr. Question CO
No. Number

1 Q1:- A set of cities are given as graph. Solve the given Travelling Salesman CO1
Problem using Branch and Bound:

2 Q2:- State n-queens problem and Explain 8-queens problem using backtracking. CO3

3 Q3:- Describe the Matrix multiplication chains problem. Apply the recursive CO2
solution of dynamic programming to determine optimal sequence of pair
wise matrix multiplications.

Assignment 5:

Sr. Question CO
No. Number

1 Q1:- Given a directed weighted graph. You are also given the shortest path CO1
from a source vertex ‘s’ to a destination vertex ‘t’. If weight of every edge
is increased by 10 units, does the shortest path remain same in the modified
graph?

2 CO1
Q2:- Consider the directed graph shown in the figure below. There are
multiple shortest paths between vertices S and T. Which one will be reported
by Dijstra’s shortest path algorithm? Assume that, in any iteration, the
shortest path to a vertex v is updated only when a strictly shorter path to v is
discovered.

3 Q3:- Suppose we run Dijkstra’s single source shortest-path algorithm on the CO3
following edge weighted directed graph with vertex P as the source. In what
order do the nodes get included into the set of vertices for which the shortest
path distances are finalized?

Assignment 6:

Sr. Question CO
No. Number

1 CO1
Q1:- Let G(V, E) an undirected graph with positive edge weights. If
Dijkstra's single-source shortest path algorithm can be implemented using
the binary heap data structure. Give its time complexity.

2 CO2
Q2:- Find the minimum cost for the following travelling salesperson
problem:
3 Q3:- Solve using Bellman Ford: CO3

Assignment 7:

Sr. Question CO
No. Number

1 Q1:- Write an algorithm for Dijkastra’s and implement with examples. CO2

2 CO2
Q2:- What do you understand by depth first search and breadth first search
explain with the help of example.
3 Q3:- What is spanning tree give an example. Write down the Prim's and CO3

Kruskal's minimum- cost spanning tree algorithms.

Assignment 8:

Sr. Question CO
No. Number

1 Q1:- What is the formula to calculate optimal solution in 0/1 knapsack problem? CO3

2 Q2:- Write some applications of travelling salesperson problem. CO4

3 Q3:- Differentiate explicit constraint and implicit constraints. CO4


Assignment 9:

Sr. Question CO
No. Number

1 Q1:- Four matrices M1, M2, M3 and M4 of dimensions pxq, qxr, rxs and CO4
sxt respectively can be multiplied is several ways with different number of
total scalar multiplications. For example, when multiplied as ((M1 X M2) X
(M3 X M4)), the total number of multiplications is pqr + rst + prt. When
multiplied as (((M1 X M2) X M3) X M4), the total number of scalar
multiplications is pqr + prs + pst. If p = 10, q = 100, r = 20, s = 5 and t = 80,
then the number of scalar multiplications needed is?
2 CO4
Q2:- Consider two strings A = "qpqrr" and B = "pqprqrp". Let x be the length
of the longest common subsequence (not necessarily contiguous) between A
and B and let y be the number of such longest common subsequences
between A and B. Then x + 10y = _.
3 CO4
Q3:- Let A1, A2, A3, and A4 be four matrices of dimensions 10 x 5, 5 x 20,
20 x 10, and 10 x 5, respectively. The minimum number of scalar
multiplications required finding the product A1A2A3A4 using the basic
matrix multiplication method is?

Assignment 10:

Sr. Question CO
No. Number

1 Q1:-Consider the graph for corresponding given matrix. Find CO5


the shortest path using Travelling Salesman Algorithm.

2 CO5
Q2:- Give the algorithm to solve n-queen problem.
3 Q3. Write an algorithm for Dijkastra’s and implement with examples. CO1
Assignment 11:

Sr. Question CO
No. Number

1 Q1:- Let G(V, E) an undirected graph with positive edge weights. If CO1
Dijkstra's single-source shortest path algorithm can be implemented using
the binary heap data structure. Give its time complexity.
2 Q2. Differentiate between dijkstra’s algorithm and bellman ford algorithm. CO3

3 Q3. What is the formula to calculate optimal solution in 0/1 knapsack CO4
problem?

Assignment 12:

Sr. Question CO
No. Number

1 Q1. Give the algorithm to solve n-queen problem CO4

2 Q2. Let A1, A2, A3, and A4 be four matrices of dimensions 10 CO2
x 5, 5 x 20, 20 x 10, and 10 x 5, respectively. The minimum
number of scalar multiplications required finding the product
A1A2A3A4 using the basic matrix multiplication method is?
3 Q3. What do you understand by depth first search and breadth first search CO4
explain with the help of example.

You might also like