You are on page 1of 11

DEPARTMENT OF COMPUTER

SCIENCE AND ENGINEERING


TUTORIAL
ON
DESIGN AND ANALYSIS OF ALGORITHMS
(17CS43)
IV SEM
QNo 1.
Using Prim’s algorithm, determine the
minimum cost spanning tree for the
following graph :
8
2 3
10 9
2 5

6 7
4
3
3
7 10 8
4
5 6
9
QNo 2.

Apply Kruskal’s algorithm to find the minimum


spanning tree of the graph:
1
a b
4
4
5
7
f 5
6 7 c

9 3
e d
2
QNo 3.
Solve the following instance of Knapsack
problem, using greedy algorithm :
Knapsack weight M = 5
Item 1 2 3 4
Weight 2 1 3 2
Profit 120 150 200 150
QNo 4.

Find solution generated by Job Sequencing


problem with deadlines for 7 jobs given
profits 3, 5, 20, 18, 1, 6, 30 and deadlines
1, 3, 4, 3, 2, 1, 2 respectively.
Qno 5.
a) Generate Huffman code for the data given
below
b) Encode the string ABACABAE
c) Decode 10000110111101

Character A B C D E
Probability 0.2 0.15 0.1 0.2 0.35
QNo 6.

Trace Heap Sort algorithm for the list


S,O, R, T, I, N, G in alphabetical order.
QNo 7.
Obtain Topological sorting for the given
diagraph using source removal and DFS
methods.
b e

a g
c
f

d
QNo 8.
Determine the shortest distances from
source vertex 5 to all the remaining
vertices using Dijikstra’s algorithm.
45
4
0
20
15
1
35
20 15
10 30
10

5
2 3
20 4
QNo 9.

Perform the Strassen’s Matrix


multiplication on the following matrices:
A=1 2 X B=5 6
3 4 7 8
QNo 10.

What is job sequencing with deadline


problem ? Design an algorithm for the
same.

You might also like