Professional Documents
Culture Documents
Answer ANY FIVE out of eight questions. Each question should be answered with adequate explanation. Figures next to
each question in square bracket indicate marks. All parts of a question must be answered at one place.
This question paper contains two pages.
R 6mM+iBQM Bi2`iBp2.6aUG, sV
ff q?2`2 G Bb ;`T? M/ s Bb i?2 bQm`+2 p2`i2t
k G2i S #2 bi+Fc
j S.push(s)cff Smb? s BMiQ i?2 bi+F S
9 // s iQ pBbBi2/ HBbic
A B
ff oBbBi2/ HBbi Bb KBMiBM2/ b bBM;Hv HBMF2/ HBbi r?2`2
ff BMb2`iBQM Bb T2`7Q`K2/ QMHv i i?2 #2;BMMBM;X
C D E F 8 r?BH2 S Bb MQi 2KTiv /Q
e v = S.pop()c
ff SQT p2`i2t 7`QK bi+F S iQ pBbBi M2ti
G H d 7Q` HH M2B;?#Qm`b w Q7 v BM G /Q
ff Smb? HH M2B;?#Qm`b Q7 p BM bi+F i?i `2 MQi pBbBi2/
Figure 1: Graph with 8 vertices 3 *?2+F r?2i?2` w Bb pBbBi2/ Q` MQic
N B7 w Bb MQi pBbBi2/ i?2M
Ry S.push(w)c
RR K`F w b pBbBi2/c
1
II sem, UG End Semester Exam Spring–2017 CS102 (DSA) 50 Marks Time 3hrs
6. (a) Let G be connected undirected graph of 100 vertices and 320 edges. The weight of a minimum spanning tree of G is
860. When the weight of each edge of G is increased by three, what will be the weight of a minimum spanning tree?
(b) Consider the following adjacency matrix for graph G1 . How many sequences (Mention them) can be attained to achieve
a minimal spanning tree by using Kruskal’s Algoritihm?
3 1 6 0 0 0
1 0 3 4 0 2
6 3 0 2 4 7
G1 =
0
4 2 2 3 1
0 0 4 3 0 5
0 2 7 1 5 0
(c) The graph shown below (Figure 2) has 8 edges with distinct integer edge weights. The minimum spanning tree (Using
Prim’s Algorithm starting from A) is of weight 36 and contains the edges: (A, C), (B, C), (B, E), (E, F), (D, F). The
edge weights of only those edges which are in the MST are marked. What is the minimum possible sum of weights of all
8 edges of this graph? Note that each edge has distinct weight. [2+4+4]
B E 4
15
A 2 F
9 6
C D
7. (a) Let A be a 4 × 4 matrix as follows — (b) Let number be an array that stores only the positive
integers 23, 99, 500, 1000, 740, 165, 800, 263, 119, 465.
9 18 27 36 What will be the outcome of the following module?
4 8 12 16
A= 2 4
6 8
5 10 15 20 Num1 =0
Num2=0
Mention the expected output of the following code while for k = 1 to 10 do
implemented on the matrix. {
If (number [k] > Num1)
C = 100 {
for i = 1 to 4 do Num2 = Num1
for j = 1 to 4 do Num1= number [k]
{ }
Temp = A[i] [j] + C Else
A[i] [j] = A[j] [i] If (number [k] > Num2)
A[j] [i] = Temp - C {
} Num2=number[k]
for i = 1 to 4 do }
for j = 1 to 4 do }
Output (A[i] [j]) Display (Num1, Num2)
4x3 + 3x5 + 7x − 1
and
2x4 − 6x3 + x2 + 6
[2.5+2.5+5]
8. (a) Insert the elements 5 7 1 9 6 0 4 10 3 2 into an initially empty m-way search tree with m = 3.
Show each intermediate step clearly with justification.
(b) Post-order traversal of a binary search tree yields 2 6 4 9 11 14 16 12 10.
Can the tree be reconstructed from this information?
If no, justify why?
If yes, derive the reconstructed tree. [5+5]