M.E / M.Tech.
PRACTICAL END SEMESTER EXAMINATIONS, JANUARY 2022
First Semester
CP4161 - ADVANCED DATA STRUCTURE AND ALGORITHMS
LABORATORY
(Regulations 2021)
Time : 3 Hours Answer any one Question
Max. Marks 100
Aim/Principle/ Tabulation/Circuit/ Calculati Viva-Voce Recor Total
Apparatus Program/Drawing/ on & d
required/Procedure/Al Flow Results/I
gorithm/Techniques chart/Schemes/Met nference
hods /Observa
tions
30 25 25 10 10 100
1. Implement a recursive function to compute nth Fibonacci number for appropriate value
of n. Analyze behavior of the program and obtain the frequency count of the
statement for various values of n.
2. Create a binary tree of integers and perform the following
- Traverse the above binary tree in-order, pre-order and post order using
recursive function.
3.
a. Write a program to generate the Fibonacci sequence using an iterative
algorithm.
2,1,4,5,9,3,6,7
b. Insert the following elements in the Red Black tree
2,1,4,5,9,3,6,7
4.
Create a binary tree of integers and perform the following
- Traverse the above binary tree in-order,pre-order and post order using iteration
function.
5.
Develop a program to sort given list of integers in ascending order using merge sort
11,23,45,87,98,121,98,786,178,1342
6. a.Perform quick sort on a set of entries from a file using recursion
b.Construct a binary search tree to insert the following key
elements.23,44,18,35,12,52,19,38, and delete 44 from it
7. Construct binary search tree for a given elements 10,8,20,6,7,15,22
1. insert the values 18,16
2. delete a leaf node
3. delete a leaf node having one child
4. delete a leaf node having two children
8. A Dictionary stores keywords & its meanings. Provide facility for adding new keywords,
deleting keywords, updating values of any entry. Provide facility to display whole data
sorted in Ascending/ Descending order. Also find how many maximum comparisons
may require for finding any keyword. Use Binary Search
Tree for implementation.
9.
Read the marks obtained by students of second year in an online examination of
particular subject. Find out maximum and minimum marks obtained in that subject. Use
heap data structure. Analyze the algorithm.
10. Write a program to implement Make_Heap, Insertion, Find_Min, Extract_Min,
Union, Decrease_Key and Delete_Key operations in Fibonacci Heap for the given
data as Student structures (contains student_name, student_roll_no, total_marks), with
key as student_ roll_no)
11. Print all the nodes reachable from a given starting node in a digraph using BFS method.
12. Write a program to check whether a given graph is connected or not using DFS
method.
13. Write a program to find Minimum Cost Spanning Tree of a given undirected
graph using Kruskal‟s:
14. From a given vertex in a weighted connected graph, write a program to find
shortest paths to other vertices using Dijkstra‟s algorithm
15. Write a program to implement All-Pairs Shortest Paths Problem using Bellman
Ford Algorithm:
16. Compute a product of chain of matrices A1,A2,A3,A4 of dimensions
5*4,4*6,6*2,2*7.The total cost of multiplication of all of them should be minimum.
17. Consider the scheduling problem. n tasks to be scheduled on single processor. Let t1...
tn be durations required to execute on single processor is known. The tasks can be
executed in any order but one task at a time. Design a greedy algorithm for this problem
and find a schedule that minimizes the total time spent by all the tasks in the system.
(The time spent by one is the sum of the waiting time of task and the time spent on its
execution.)
18. Build the Huffman tree to encode and decode the given message
“ She sells seashells on the seashore”
using Huffman tree algorithm
19. A given table shows lectures delivered by faculty with start and finish time .choose
appropriate data structure /libraries and use it to satisfie the condition
1. No over lapping of timing
2. The output should give maximum no of compatible activities possible.
Start 1 2 3 4 5 6
Time
Finish 4 3 5 6 9 8
Time
20. a .Insert the following elements in the Red Black tree 2,1,4,5,9,3,6,7
b. Arrange the Numbers in ascending order using Merge sort
123,23,1,43,54,36,75,34,