2023-Dec CS-201 140
2023-Dec CS-201 140
tTTT -g-111--DF
-g-Atzts- (ft,31;) - 177 005 (iNct)
NATIONAL INSTITUTE OF TECHNOLOGY HAMIRPUR
HAMIRPUR (H.P.) - 177 005 (INDIA)
(An Institute of National Importance under Ministry of HRD)
Q.4 a) Draw the minimum spanning tree (MST) of the following graph using
Kruskal's algorithm. Explain each step and write the weight of the
resulting MST.
b) Using Dijkstra's Algorithm, find the shortest distance from source vertex
S' to remaining vertices in the following graph. Explain each step in
detail.
Q.5 a) Write the algorithm for finding the number of external nodes in a binary
tree.
d) Write the algorithm for searching an element in singly linked list and
discuss its complexity.
7C7,2CXXXXX7171*WW,IVCW'217C7C21,1W/CWX
'CALL THE BEST
r6071 a fliThl
TitRV P.R.) - 177 005 0--ITT-a)
NATIONAL INSTITUTE OF TECHNOLOGY HAMIRP
HAMIRPUR (H.P.) - 177 005 (INDIA)
(An Institute of National Importance under Ministry of HRD)
Q.1 a) Define data structure. List the various linear and non-linear data [5]
structures and explain them in brief
b) How stack can be used to recognize strings like aca, bcb, abcba, bacab, [5]
abbcbba? Write the algorithm for it and Show the trace of contents of
stack for recognizing the string abcba.
Q.2 a) Write an efficient algorithm to merge two sorted link list into one sorted [5]
link list without using extra space for merging. (few temporary pointers
can be used)
b) Write down the algorithm for Insertion sort. Discuss its best case, [5]
average case and worst case analysis in detail.
b) Draw an AVL tree for the numbers from 1 to 10. After creating the [5]
tree delete following numbers one by one:
4, 8
Follow the order of elements given for insertion and deletion. Show
AVL tree after each insertion and deletion. Also mention the type of
rotation at each step that is used at the time of insertion and deletion.
P.T.O.