You are on page 1of 1

Roll Number:

Thapar Institute of Engineering and Technology, Patiala


Computer Science and Engineering Department
MCA (1St Year) End-Sem Test; Jan. 27, 2021 MCA-105: Data Structures and Algorithms
Time: 02 Hours; MM: 50 Name of Faculty: Dr. Rinkle Rani
Note : Attempt any five questions.
Q1 a) Apply Dijkstra's algo on the directed weighted graph given in figure 1 with source S. (6)
b) Define Graph. Discuss the various memory representations techniques used for graph
with the help of an example. (4)
Q2 a) Solve All Pairs Shortest Path problem (Floyd's Algo) for the directed weighted graph (7)
given in figure 2.
b) Evaluate the following postfix expression using stack as an intermediate structure. (3)
6 5 2 3+ 8 * + 3 + *
Q3 a) Write an algorithm/program to insert a new given node in a sorted singly linked list. (6)
Illustrate your logic with suitable example and diagram also.
b) Develop a BST by inserting nodes from the following sequence one by one. (4)
62 29 22 58 37 35 47 42 52 75 92 82 97
Perform the following operations on the above resulting tree independently.
(i) Node 29 is deleted (ii) Node 75 is deleted (iii) Node 58 is deleted
Q4 a) Design an extended binary tree (Hoffman Algorithm) from the following sequence (7)
of nodes and find out the minimum weighted path length.
12 43 16 51 17 26 13 15 14 18 34
b) For the binary tree given in figure 3 answer the following (3)
(i) Write inorder, preorder and postorder traversals.
(ii) How much memory is required to store this binary tree sequentially?
Q5 a) Design a max heap from the following sequence of nodes. Apply Heap Sort algorithm on (7)
this heap. Draw all the intermediate trees for insertions and deletions.
38 24 44 21 55 47 67 49
b) Write algorithm for bubble sort and apply the same on the following sequence of nodes. (3)
18 15 17 13 12 11 16 14 19
Q6 a) Write algorithm(s) / program to show how you can insert and delete an element in a (7)
circular queue. Discuss your algorithm(s) with the help of suitable examples also.
b) Convert the following infix expression into the postfix expression using stack as an (3)
intermediate structure.
P + ( y * z - (a / b -g) * m ) * x
Q 7. Differentiate between (10)
a) Stack and Queue b) Array and Linked List
c) Linear and Binary Search d) BFS and DFS
...._

Figure 1. Figure 2. Figure 3.

You might also like