0% found this document useful (0 votes)
20 views2 pages

2023-Dec CS-201 140

NITH cs
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)
20 views2 pages

2023-Dec CS-201 140

NITH cs
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/ 2

"Ux&FYzi M1 a fti.

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.

b) Write overflow and underflow condition of the Circular queue implemented


using array.

c) Write an algorithm to delete an element from the queue implemented


using linked list.

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)

Computer Science & Engineering Department


End Semester Exam-November 2023

Course: ECE B.Tech. (76-119)/DD(1-28) Semester: 3rd


Subject Code: CS-201 Duration: 3 Hours
Subject Name: Data Structures Max Marks: 50
Date: 28/11/2023 Time: 09:30AM-12:30PM

Note: All questions are compulsory

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.

Q.3 a) Construct the tree using the following traversals [5]


Preorder traversal of the tree is: 7, 1, 0, 3, 2, 5, 4, 6, 9, 8, 10
Inorder traversal of the tree is: 0, 1,2,3,4,5,6,7,8,9,10
Explain each step in detail. What is the Postorder traversal?

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.

You might also like