CS3401 Set1
CS3401 Set1
CS3401 Set1
Fourth Semester
(Regulations - 2021)
Date: 22.11.2023
Time: 3 Hours Answer any one Questions Max. Marks 100
1. Implement the binary search algorithm in C and analyse its time complexity.
2. Implement Linear Search. Determine the time required to search for an element. Repeat the
experiment for different values of n, the number of elements in the list to be searched and plot a graph
of the time taken versus n.
3. Implement Insertion sort and repeat the experiment for different values of n, the number of elements
in the list to be sorted and plot a graph of the time taken versus n.
4. Given a text txt [0...n-1] and a pattern pat [0...m-1], write a function search (char pat [ ], char txt [ ])
that prints all occurrences of pat [ ] in txt [ ]. You may assume that n > m.
6. Write a C program to implement the depth first search algorithm for a graph and analyse its time
complexity.
7. Develop a program to find the shortest paths to other vertices using Dijkstra’s algorithm.
8. Develop a program to implement Floyd’s algorithm for the All-Pairs- Shortest-Paths problem.
Page 1 of 2
9. Implement prims algorithm for finding the minimum spanning tree of an undirected graph.
10. Develop a program to find out the maximum numbers in a given list of n numbers using the divide
and conquer technique.
11. Implement the heap sort algorithm in C. Compare its performance with other sorting algorithms for
different input sizes.
12. Implement quick sort algorithm and analyse its time complexity.
13. Implement Traveling Salesperson problem and then solve the same problem instance using any
approximation algorithm and determine the error in the approximation.
15. Implement randomized algorithms for finding the kth smallest number.
Page 2 of 2