Reg.
No:
B.E. DEGREE EXAMINATION - INTERNAL – I [2024 – 2025] (EVEN)
II Year & IV Semester
CS 3401 – ALGORITHMS
Question paper code – VCECS45
(Regulation 2021)
Department: CSE Date/Session: 02/3/2025 & FN
Duration: 2 hrs. Maximum: 60 Marks
PART-A
Answer All the Questions (7*2=14 Marks)
1. State how the running time of an algorithm is measured (Remember)
2. Define recursion relation (Understand)
3. Discuss the time and space complexity of insertion sort (Apply)
4. What is a strongly connected graph give an example? (Remember)
5. List the types of asymptotic notations in analysing complexity of algorithm (Remember)
6. Outline a directed graph with an example (Understand)
7. Differentiate between binary search and interpolation search? (Apply)
PART-B
Answer All the questions (2*13= 26 Marks)
8. (a) Write the asymptotic notations used for best case, average case and worst case
analysis of algorithms. Also write an algorithm of finding maximum element of
an array and perform best, worst and average case complexity with appropriate
order notations. (13) (Apply)
(OR)
(b) (i) Write and explain naive string mating algorithm. (7) (Understand)
(ii) Suppose T=1011101110 and p = 111. Find all valid ships. (6) (Apply)
9. (a) (i) Write the pseudocode for BFS and DFS traversals on the graph given below and
compare the time and space complexity of the two traversals. (13) (Apply)
(OR)
(b) (i) Apply a Insertion sort algorithm to sort the following sequence of n numbers sorted
in an array A= 15,9,1,22,26,19,55,43,99,2 Illustrate the each step of the sorting process?
(13) (Apply)
PART – C
Answer the Following (2*10 = 20 Marks)
10. (a) (i) How many spurious hits does the Rabin-Karp matcher encounter in the text
T = 3141592653589793 when Working modulo q = 11 and looking for the pattern
P = 26. Briefly write about the processing time, worst-case running time and
Average - case running time of Rabin-Karp algorithm. (10) (Apply)
(OR)
(b) (i) With an example A= 15,9,1,22,26,19,55,43,99,2 to show the best-case, worst
case and average case analysis of heap sort. (10) (Apply)
11. (a)(i) Explain the working of naive string matching algorithm with ABCCDDAEFG as
the text input and CDD as the search string. (5) (Apply)
(ii) With a suitable example, illustrate the time and space complexity analysis of binary
search (5) (Apply)
(OR)
(b)(i) Explain in detail about interpolation search with the following example
15,9,1,22,26,19,55,43,99,2 to search a key element 26 and its best, worst and average case
analysis. (10) (Apply)
Faculty In-charge HOD/CSE