LabExercises
LabExercises
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.
Graph Algorithms
1.Develop a program to implement graph traversal using Breadth First Search
2.Develop a program to implement graph traversal using Depth First Search
3.From a given vertex in a weighted connected graph, develop a program to find the shortest paths to other vertices using
Dijkstra’s algorithm.
4.Find the minimum cost spanning tree of a given undirected graph using Prim’s algorithm.
5.Implement Floyd’s algorithm for the All-Pairs- Shortest-Paths problem.
6.Compute the transitive closure of a given directed graph using Warshall's algorithm.