CS3401 ALGORITHMS LAB SET
CS3401 ALGORITHMS LAB SET
CS3401 ALGORITHMS
(Regulations 2021)
1. 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.
2. Implement recursive Binary Search. Determine the time required to search 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. 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.
4 Sort a given set of elements using the Insertion sort and Heap sort methods and determine the time
required to sort the elements. 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.
7. From a given vertex in a weighted connected graph, develop a program to find the shortest paths to
other vertices using Dijkstra’s algorithm
8 Find the minimum cost spanning tree of a given undirected graph using Prim’s algorithm.
10 Compute the transitive closure of a given directed graph using Warshall's algorithm.
Page 1 of 2
11 Develop a program to find out the maximum and minimum numbers in a given list of n numbers
using the divide and conquer technique.
12 Implement Merge sort and Quick sort methods to sort an array of elements and determine the time
required to sort. 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.
14 Implement any scheme to find the optimal solution for the 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. The programs can be
implemented in C/C++/JAVA/ Python.
Page 2 of 2