100% found this document useful (1 vote)
23 views2 pages

CSD3009 - Data Structure and Analysis of Algorithm

Uploaded by

deva.jan2002
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
100% found this document useful (1 vote)
23 views2 pages

CSD3009 - Data Structure and Analysis of Algorithm

Uploaded by

deva.jan2002
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

Reg. No.

:
Name :

TERM END EXAMINATIONS (TEE) – February-March 2023


Programme : B.Tech. Semester : Winter 2022-23
Course Title/ Data Structures and Analysis of
: Slot : B11+B12+B13
Course Code Algorithms/ CSD3009
Time : 1½ hours Max. Marks : 50

Answer ALL the Questions

Q. No. Question Description Marks

PART - A ( 30 Marks)
1 (a) Let A and B be two linked lists. Write a function to create a new linked list C that 10
contains elements alternative from A to B in reverse order beginning with the last
element of A. If you run out of elements in one of the lists, then append the remaining
elements of the other list to C. Discuss its time and space complexity.
OR
(b) Suppose you have railroad shunting yard with three shunting tracks that operate as 10
queue. The initial ordering of car/bogie is 3, 1, 8, 2, 7, 4, 5,9, 6. Following figure shows
the configuration of the shunting tracks, the input track, and the output track. Write a
step-by-step procedure to rearrange the all-inputs car using these three shunting tracks
with assumption that only one car can be moved at a time. Also write a program to
solve railroad cars arrangement problem. Discuss its time complexity.
H1

H2 9 8 7 6 5 4 3 2 1
6 9 5 4 7 2 8 1 3

Input Track Output Track

H3

Shunting Tracks

2 (a) What is the bottleneck of binary search tree (BST)? How it is minimized by AVL Tree? 10
Show the result of inserting the following elements 22, 45, 65, 67, 78, 89, 87, 65, 54,
43, 32, 57, 48, 39, 26, 37, 60, 40, 20 into an initially empty AVL tree. Specify the type
of rotation after each insertion.
OR
(b) Consider the following list: 10
45,56,78,23,11,54,88,43,55,21,67,55

Page 1 of 2
Sort the above list by using:
o Quick sort
o Radix sort
Analyse the time complexity of both the sorting algorithm.
3 (a) Explain the divide and conquer approach for algorithm design. How the merge sort is 10
used as divide and conquer approach? Write and solve the recurrence relation of merge
sort. Also explain the working of merge sort on the following data:
11, 66, 33, 77, 88, 22, 44, 55, 99
OR
(b) For the digraph of Figure below obtain: 10
I. its adjacency matrix and its adjacency list representation
II. Breadth First Search (BFS) traversal of the graph.
III. Depth First Search (DFS) traversal of the graph.

1 3

4
2

5
6

PART - B (20 Marks)


4 Is it possible to have unique re-constructed binary tree given its pre-order and post- 10
order traversals? Justify your answer. Given the following inorder and preorder
traversal reconstruct a binary tree.
Inorder – 11,28,23,34,15,17,42,19
Preorder – 15,23,11,28,34,19,17,42
Also determine post order traversal of the re-constructed binary tree.

5 Explain and write the algorithm of the single source shortest path problem. Find the 10
shortest path from the source node 5 to destination node 1. Also discuss its time
complexity.
2 5
1500
300 800
1200 4 250
1000
1000 3
1 6
1400
8
1700 900

1000
7



Page 2 of 2

You might also like