CS3401 - Algorithms - QB - EVEN - AY - 24 - 25 - Completed
CS3401 - Algorithms - QB - EVEN - AY - 24 - 25 - Completed
Unit I
Part – A
Sl. Blooms
Question
No. Level
1 Define time complexity of an algorithm.
9 Define an algorithm.
Part – B
Sl. Blooms
Question
No. Level
Write an algorithm to perform linear search on an array of ‘N’ numbers. Illustrate the best case,
1
average case and worst case complexity of the linear search algorithm with an example.
What is pattern searching? Outline the steps in the Rabin-Karp algorithm for pattern searching
2
with an example.
Write the algorithm to finding maximum element of an array; perform best, worst and average
3
case complexity with appropriate order notations.
(i) Write and explain naive string mating algorithm.
4
(ii) Suppose T = 1011101110 and p = 111. Find all valid ships.
(i) Explain in detail about various asymptotic notations and its properties.
5
(ii) Use substitution method to show that T(n) = 2T(n/2) + n is O(n log(n)).
With a suitable example, illustrate the time and space complexity analysis of binary search and
6
linear search.
Explain the working of naive string matching algorithm with ABCCDDAEFG as the text input and
7
ODD as the search string.
Page 1 of 6
Course Code & Name CS3401 – ALGORITHMS
Unit II
Part – A
Sl. Blooms
Question
No. Level
6 Prove that the number of odd degree vertices in a connected graph should be even.
Part – B
Sl. Blooms
Question
No. Level
1 Outline the Depth First search & Breadth First search algorithms with suitable examples.
3 Write and explain the pseudo code for breadth first search and discuss its time complexity.
4 Write and explain the pseudo code for Floyd Warshall algorithm and write its time complexity.
Write the pseudocode for BFS and DFS traversals on the graph given fig. and compare the time
and space complexity of the two traversals.
Find the Minimum Spanning Tree of the following graph using Kruskal’s algorithm.
Given a graph and a source vertex in the graph, find the shortest paths from the source vertex 0
7
to all vertices in the given graph
Page 2 of 6
Course Code & Name CS3401 – ALGORITHMS
Sl. Blooms
Question
No. Level
Using Ford-Fulkerson algorithm find the maximum possible flow in the network given below
Unit III
Part – A
Sl. Blooms
Question
No. Level
7 What are the differences between dynamic programming and divide and conquer approaches?
10 Write the difference between the Greedy method and Dynamic programming.
Part – B
Sl. Blooms
Question
No. Level
What is a Huffman tree? Outline the steps to build a Huffman tree using greedy algorithm design
2
paradigm with an example.
Explain in detail about merge sort. Illustrate the algorithm with a numeric example and provide
3
complete analysis of merge sort algorithm.
4 Explain the dynamic programming approach of matrix multiplication with an example.
Demonstrate Quick sort and Merge sort, and arrange the following numbers in increasing order
5
using merge sort. (28, 39, 78, 42, 53, 47, 77, 44, 57, 60).
Page 3 of 6
Course Code & Name CS3401 – ALGORITHMS
Sl. Blooms
Question
No. Level
Solve the following problem using Greedy algorithm. Given activities with their start and finish
6 times, select the maximum number of activities that can be performed by a single person,
assuming that a person can only work on a single activity at a time.
A character-coding problem. A data file of 100,000 characters contains only the characters a-f,
with the frequencies indicated as below\
a b c d e f
7
Frequency
45 13 12 16 9 5
(in thousands)
Show the steps in constructing the final Huffman tree representing the optimal prefix code.
Unit IV
Part – A
Sl. Blooms
Question
No. Level
1 What is backtracking?
2 What are the factors that influence the efficiency of the backtracking algorithm?
Why is branch and bound approach found to be appropriate for solving travelling salesman
6
problem?
7 When can a node be terminated in the subset-sum problem?
10 State the reason for terminating search path at the current node in branch and bound algorithm.
Part – B
Sl. Blooms
Question
No. Level
State the Hamiltonian circuit problem. Outline the steps to find the Hamiltonian circuit using
1
backtracking algorithm design paradigm with an example.
State the Knapsack problem. Outline how Knapsack problem can be solved using branch and
2
bound algorithm design paradigm with an example.
Write down the steps to solve Travelling Salesperson problem using branch and bound
4
approach. Explain with an example.
(i) Explain the steps in solving n-queens problem using backtracking approach.
5 (ii) Solve the following subset sum problem using back tracking.
Let S = {3,7,9,13,26,41}; d(sum) = 51.
Discuss briefly about the abstraction for Backtracking method and discuss the backtracking
6
solution to solve 8-Queens problem.
Page 4 of 6
Course Code & Name CS3401 – ALGORITHMS
Unit V
Part – A
Sl. Blooms
Question
No. Level
Part – B
Sl. Blooms
Question
No. Level
1 Elaborate NP-complete problem and NP-hard problem with an example.
(i) Illustrate polynomial-time approximation scheme for the sum of subsets problem.
7
(ii) Illustrate the working of Miller-Rabin randomized primality test.
Part – C
Sl. Blooms
Question
No. Level
Apply the insertion sort algorithm to sort the following sequence of n numbers stored in an array
A.
1
15,9,1,22,26,19,55,43,99,2
Illustrate each step of the sorting process.
What is dynamic programming? Explain the dynamic programming solution fox' matrix chain
2
multiplication with an example.
Page 5 of 6
Course Code & Name CS3401 – ALGORITHMS
Sl. Blooms
Question
No. Level
Write and explain the Dijikstra’s algorithm. Find the shortest path the following graph using
Dijikstra’s algorithm.
Solve the following instance of Knapsack problem by branch and bound algorithm.
1 5 $40
4 2 7 $35
3 2 $18
4 4 $4
5 5 $10
6 1 $2
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
5
write about the processing time, worst-case running time and average-case running time of
Rabin-Karp algorithm.
6 With an example, show the best-case, worst-case and average case analysis of heap sort. `
Run the Bellman-Ford algorithm on the directed graph of the following figure using vertex S as
the source and show the results after each pass of an algorithm.
With an example, Show that the cardinality of a maximum matching M in a bipartite graph G
8
equals the value of a maximum flow f in its corresponding flow network G’.
Page 6 of 6