JEPPIAAR NAGAR, RAJIVGANDHI SALAI
CHENNAI-600119
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
II YEAR B.E – IV SEM
ACADEMIC YEAR 2024-2025(EVEN SEMESTER)
Name : ______________________________
Register No : ______________________________
Subject Name : ______________________________
Subject Code : ______________________________
Batch : ______________________________
JEPPIAAR NAGAR, RAJIVGANDHI SALAI
CHENNAI-600119
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
This is a Bonafide Record work of ___________________ Register No.
__________________ Submitted for the Anna University Practical Examination held on
_____________ in CS3401-ALGORITHMS LABORATORY during the academic year
_____________.
Signature of the Lab-In-Charge Signature of the HOD
Internal Examiner: External Examiner:
COLLEGE VISION AND MISSION
Vision
To build Jeppiaar Engineering College as an institution of academic excellence in technological and management education to
become a world class university.
Mission
To excel in teaching and learning, research and innovation by promoting the principles of scientific analysis and creative
thinking.
To participate in the production, development and dissemination of knowledge and interact with national and
international communities.
To equip students with values, ethics and life skills needed to enrich their lives and enable them to contribute for the
progress of society.
To prepare students for higher studies and lifelong learning, enrich them with the practical skills necessary to excel as
future professionals and entrepreneurs for the benefit of nation’s economy.
Program Outcomes
COURSE OUTCOMES (CO)
CO1 Analyze the efficiency of algorithms using various frameworks.
CO2 Apply graph algorithms to solve problems and analyze their efficiency.
CO3 Make use of algorithm design techniques like divide and conquer, dynamic programming and greedy
techniques to solve problems.
CO4 Use the state space tree method for solving problems.
CO5 Solve problems using approximation algorithms and randomized algorithms
INDEX
Sl. Ex. No Date Title of the Experiments Page Staff
No No. Sign
1 Implement Linear Search to Determine the
Time Required to Search for an Element
2 Implement recursive binary search to determine
the time required to search an element
3 Implement pattern matching algorithm using
text sequence
4 Sort a given set of elements using the insertion
sort and heap sort methods
5 Implement graph traversal using breadth first
search
6 Implement graph traversal using depth first
search
7 Develop a program to find the shortest paths to
other vertices using dijkstra’s algorithm
8 Develop a program to find minimum spanning
tree of undirected graph using prim’s algorithm
9 Implement floyd’s algorithm for the all-pairs-
shortest-paths problem
10 Compute the transitive closure of a given
directed graph using warshall's algorithm
11 Develop a program to find out the maximum
and minimum numbers using the divide and
conquer technique
12 Implement merge sort and quick sort methods
to sort an array of elements
13 Implement n queens problem using
backtracking
14 Implement any scheme to find the optimal
solution for the traveling salesperson problem
15 Implement randomized algorithms for finding
the kth smallest number using python
Exp. No: 1 IMPLEMENT LINEAR SEARCH TO DETERMINE THE TIME REQUIRED
Date: TO SEARCH FOR AN ELEMENT
Result:
The linear search algorithm was implemented and tested with varying list sizes. The results
showed that the time taken to search increased linearly with the number of elements,
confirming the O(n) time complexity.
Exp. No: 2 IMPLEMENT RECURSIVE BINARY SEARCH TO DETERMINE THE TIME
Date: REQUIRED TO SEARCH AN ELEMENT
Result:
Recursive binary search was implemented, and the experiment showed that the time taken
grew logarithmically with list size, validating its O(log n) time complexity.
Exp. No: 3 IMPLEMENT PATTERN MATCHING ALGORITHM USING TEXT SEQUENCE
Date:
Result:
The pattern matching algorithm accurately found pattern positions, with time increasing
linearly with text and pattern size.
Exp. No: 4 SORT A GIVEN SET OF ELEMENTS USING THE INSERTION SORT AND
Date: HEAP SORT METHODS
Result:
Insertion Sort and Heap Sort were implemented; results showed Insertion Sort was efficient
for small datasets, while Heap Sort performed better on larger inputs.
Exp. No: 5 IMPLEMENT GRAPH TRAVERSAL USING BREADTH FIRST SEARCH
Date:
Result:
Breadth First Search (BFS) was implemented for graph traversal, and the experiment
showed that all reachable nodes were visited level by level efficiently.
Exp. No: 6 IMPLEMENT GRAPH TRAVERSAL USING DEPTH FIRST SEARCH
Date:
Result:
Depth First Search (DFS) was implemented for graph traversal, and the experiment
demonstrated efficient exploration of all nodes by going as deep as possible before
backtracking.
Exp. No: 7 DEVELOP A PROGRAM TO FIND THE SHORTEST PATHS TO
Date: OTHER VERTICES USING DIJKSTRA’S ALGORITHM
Result:
Dijkstra’s algorithm was implemented to find the shortest paths from a source vertex, and
the experiment showed accurate and efficient computation of minimum distances to all
other vertices.
Exp. No: 8 DEVELOP A PROGRAM TO FIND MINIMUM SPANNING
Date: TREE OF UNDIRECTED GRAPH USING PRIM’S ALGORITHM
Result:
Prim’s algorithm was implemented to find the Minimum Spanning Tree (MST) of an
undirected graph, and the experiment showed successful construction of an MST with
minimum total edge weight.
Exp. No: 9 IMPLEMENT FLOYD’S ALGORITHM FOR THE ALL-PAIRS- SHORTEST-
Date: PATHS PROBLEM
Result:
The shortest path distances between all pairs of vertices are successfully computed and
stored in a matrix, where each element represents the shortest distance between two vertices.
Exp. No: 10 COMPUTE THE TRANSITIVE CLOSURE OF A GIVEN DIRECTED GRAPH
Date: USING WARSHALL'S ALGORITHM
Result:
The transitive closure matrix indicates which vertices are reachable from other vertices,
where a 1 represents a reachable path and a 0 indicates no path exists between the respective
vertices. The matrix is updated iteratively to include all reachable paths.
Exp. No: 11 DEVELOP A PROGRAM TO FIND OUT THE MAXIMUM AND MINIMUM
Date: NUMBERS USING THE DIVIDE AND CONQUER TECHNIQUE
Result:
The Divide and Conquer technique efficiently finds the maximum and minimum numbers
by recursively dividing the array into smaller subarrays and comparing the results.
Exp. No: 12 IMPLEMENT MERGE SORT AND QUICK SORT METHODS TO SORT
Date: AN ARRAY OF ELEMENTS
(i) Merge Sort
(ii) Quick Sort
Result:
Merge Sort and Quick Sort both sort the array effectively with average time complexities of
O(n log n)
Exp. No: 13 IMPLEMENT N QUEENS PROBLEM USING BACKTRACKING
Date:
Result:
The N-Queens problem is solved using backtracking, placing N queens on an N×N board
such that no two queens threaten each other.
Exp. No: 14 IMPLEMENT ANY SCHEME TO FIND THE OPTIMAL SOLUTION FOR
Date: THE TRAVELING SALESPERSON PROBLEM
Result:
The optimal solution for the Traveling Salesperson Problem (TSP) is found using a heuristic
approach like Dynamic Programming or Branch and Bound.
Exp. No: 15 IMPLEMENT RANDOMIZED ALGORITHMS FOR FINDING THE KTH
Date: SMALLEST NUMBER USING PYTHON
Result:
The randomized algorithm for finding the Kth smallest number efficiently selects a pivot
and partitions the array, narrowing down the search.