0% found this document useful (0 votes)
0 views

Algorithms

The document is a question bank for a Design and Analysis of Algorithms course at Bapuji Institute of Engineering and Technology. It includes a variety of questions categorized by Bloom's levels, covering topics such as algorithm construction, efficiency analysis, sorting algorithms, and recursive problem-solving. The questions require students to illustrate concepts, design algorithms, analyze time complexities, and apply specific algorithms to given data sets.

Uploaded by

mnidish3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

Algorithms

The document is a question bank for a Design and Analysis of Algorithms course at Bapuji Institute of Engineering and Technology. It includes a variety of questions categorized by Bloom's levels, covering topics such as algorithm construction, efficiency analysis, sorting algorithms, and recursive problem-solving. The questions require students to illustrate concepts, design algorithms, analyze time complexities, and apply specific algorithms to given data sets.

Uploaded by

mnidish3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Bapuji Institute of Engineering and Technology

Computer Science and Engineering Department


Fourth Semester
Design and Analysis of Algorithms
Date:24-03-2025

Question Bank

Bloom’s Level (L1 and L2)

1. Illustrate the different stages involved in algorithm construction and analysis with a
diagram.
2. Define algorithm. Explain asymptotic notations Big Oh, Big Omega, and Big Theta

3. If t1(n) ∈ O(g1(n)) and t2(n) ∈ O(g2(n)), then show that t1(n) + t2(n) ∈
notations.

O(max{g1(n), g2(n)})
4. Explain the general plan for analyzing the efficiency of a recursive algorithm. Suggest
a recursive algorithm for a tower of Hanoi problem. Derive its efficiency.
5. Explain the general plan for analyzing the efficiency of a non-recursive algorithm.
Suggest a non-recursive algorithm to find the maximum element in the list of n
numbers. Derive its efficiency.
6. Explain with an algorithm to derive the worst-case efficiency for Bubble sort.
7. Explain the concept of divide and conquer. Design an algorithm for merge sort and
derive its time complexity.
8. Explain Strassen’s matrix multiplication and derive its time complexity.
9. Construct sequential search algorithm and analyze its time efficiency.
10. Construct Brute force pattern matching algorithm and analyze its time efficiency.
11. Explain Strassen’s Matrix Multiplication and analyze its time efficiency.

Bloom’s Level (L3)


1. Design an algorithm for quick sort algorithm. Apply quick sort on these elements.
25,75,40,10,20,05,15.
2. Design an insertion sort algorithm and obtain its time complexity. Apply insertion sort
on these elements. 25,75,40,10,20,05,15.
3. Design Selection Sort Algorithm and analyze its time efficiency.Apply selection sort
on these elements. 25,75,40,10,20,05,15.
4. Design an algorithm to find all the common elements in two sorted lists of numbers.
For example, for the lists 2, 5, 5, 5 and 2, 2, 3, 5, 5, 7, the output should be 2, 5,
5.What is the maximum number of comparisons your algorithm makes if the lengths
of the two given lists are m and n, respectively?
5. Find gcd(31415, 14142) by applying Euclid’s algorithm.
6. Construct an algorithm to find the minimum distance between two closest elements in
an array. Analyse its time efficiency.
7. Consider the following algorithm.
ALGORITHM Mystery(n)
//Input: A nonnegative integer n
S←0

S←S+i∗i
for i ← 1 to n do
return S
 What does this algorithm compute?
 What is its basic operation?
 How many times is the basic operation executed?
 What is the efficiency class of this algorithm?
 Suggest an improvement, or a better algorithm altogether, and indicate its
efficiency class. If you cannot do it, try to prove that, in fact, it cannot be
done.
8. Consider the following algorithm.
ALGORITHM Secret(A[0..n − 1])
//Input: An array A[0..n − 1] of n real numbers
minval ← A[0];
maxval ← A[0]
for i ← 1 to n − 1 do
if A[i] < minval
minval ← A[i]
if A[i] > maxval
maxval ← A[i]
return maxval – minval

 What does this algorithm compute?


 What is its basic operation?
 How many times is the basic operation executed?
 What is the efficiency class of this algorithm?
 Suggest an improvement, or a better algorithm altogether, and indicate its
efficiency class. If you cannot do it, try to prove that, in fact, it cannot be
done.

9. Consider the following algorithm.


ALGORITHM Enigma(A[0..n − 1, 0..n − 1])
//Input: A matrix A[0..n − 1, 0..n − 1] of real numbers
for i ← 0 to n − 2 do
for j ← i + 1 to n − 1 do
if A[i, j ] = A[j, i]
return false
return true

 What does this algorithm compute?


 What is its basic operation?
 How many times is the basic operation executed?
 What is the efficiency class of this algorithm?
 Suggest an improvement, or a better algorithm altogether, and indicate its
efficiency class. If you cannot do it, try to prove that, in fact, it cannot be
done.

10. Consider the following algorithm.


ALGORITHM S(n)
//Input: A positive integer n
//Output: The sum of the first n cubes
if n = 1
else return S(n − 1) + n ∗ n ∗ n
return 1

 Set up and solve a recurrence relation for the number of times the algorithm’s basic
operation is executed.
 How does this algorithm compare with the straightforward non-recursive algorithm
for computing this sum?
11. Consider the following recursive algorithm.
ALGORITHM Q(n)
//Input: A positive integer n
if n = 1

else return Q(n − 1) + 2 ∗ n – 1


return 1

 Set up a recurrence relation for this function’s values and solve it to determine what
this algorithm computes.
 Set up a recurrence relation for the number of multiplications made by this algorithm
and solve it.
 Set up a recurrence relation for the number of additions/subtractions made by this
algorithm and solve it.

12. A network topology specifies how computers, printers, and other devices are connected
over a network. The figure below illustrates three common topologies of networks: the ring,
the star, and the fully connected mesh.

You are given a boolean matrix A[0..n − 1, 0..n − 1], where n > 3, which is supposed to be
the adjacency matrix of a graph modeling a network with one of these topologies. Your task
is to determine which of these three topologies, if any, the matrix represents. Design a brute-
force algorithm for this task and indicate its time efficiency class.

13. Apply the DFS-based algorithm to solve the topological sorting problem for the following
digraphs:

14. Design Merge Sort Algorithm and analyze its time efficiency. Apply Merge sort on these
elements. 25,75,40,10,20,05,15.
15. Design Qucik Sort Algorithm and analyze its time efficiency. Apply Quick sort on these
elements. 25,75,40,10,20,05,15.

You might also like