ADA Question Bank
ADA Question Bank
FACULTY OF ENGINEERING
TH SEMESTER
5
WINTER-2024
Prof.- Manish Kumar Singh
Analysis & Design of Algorithms
Question Bank
.
1 efine algorithm. Discuss key characteristics of algorithms.
D
2. What is asymptotic notation? Why is analysis of algorithms required?
3. Explain linear inequality and equations.
4. Explain why analysis of algorithms is important? Explain: Worst case, best case
and average case time complexity.
5 . Define: Space complexity & Time complexity
6. Define following terms with mathematical explanation:
(i) Big ‘Oh’ Notation (ii) Big ‘Omega’ Notation (iii) ‘Theta’ Notation
7. Write an iterative and recursive algorithm for finding the factorial of N. derive the
time complexity of both algorithms.
8. Solve the following recurrence relation using the iteration method.
𝑛 2
T(n) = 8T(2 ) +𝑛 . Here T(1) = 1.
9 . Find out big-oh notation of the f(n)= 3n 2 +5n+10
10.What is recurrence? Solve recurrence equation T (n) =T (n-1) + n using backward
substitution method.
11.Sort the given elements with Heap Sort Method: 20, 50, 30, 75, 90, 60, 25, 10, and
40.
12.Which are the basic steps of counting sort? Write a counting sort algorithm.
Derive its time complexity in the worst case.
13.Write down the Best case, Worst Case and Average case, Time-Complexity for the
following algorithms:
(i) Bubble sort, (ii) Selection sort, (iii) Insertion sort, (iv) Shell sort, (v) Heap sort,
(vi) Bucket sort, (vii) Radix sort, (viii) Counting sort.
𝑛 2
14.Explain Asymptotic notation. Arrange the growth rate of2 ,𝑛 , 1, log n, n logn,
3nandnin increasing order of growth.
15.How do divide and conquer approaches work? What do you mean by Divide &
Conquer approach? List advantages and disadvantages of it.
2
1 6.Find out big-oh notation of the f(n) = 3𝑛 +5n+10
17.State whether the statements are correct or incorrect with reasons.
1. O(f(n)) + O(f(n)) = O (2f(n))
2 2
2 . If 3n + 5 = O(𝑛 ) , then 3n + 5 = o(𝑛 )
18.Solve the following using Master’s theorem:
a. T(n) = 2T(n/4) + 1
b. T(n)=3T(n/4) + nlgn
2
19.Perform the analysis of a recurrence relation T(n)= 2T (n/2) + θ(𝑛 ) by drawing its
recurrence tree.
20.Explain how multiplication of large integers can be done efficiently by using
divide and conquer technique?
21.Demonstrate Binary Search method to search Key = 14, form the array
A= <2,4,7,8,10,13,14,60>.
Page1
Analysis & Design of Algorithms
Question Bank
Page2
Analysis & Design of Algorithms
Question Bank
42.Write the characteristics of greedy algorithms. Mention any two examples of
greedy methods that we are using in real life.
43.Explain term –optimal substructure property.
44.Explain the difference between Greedy and Dynamic Algorithms.
45.What are the disadvantages of greedy methods over dynamic programming
methods?
46.Find an optimal Huffman code for the following set of frequency. a : 50, b: 20, c:
15, d:30.
47."A greedy strategy will work for fractional Knapsack problem but not for
0/1", is this true or false? Explain.\
48.Write Kruskal's Algorithm to find out the Minimum Spanning Tree.
pply the
A
same and find MST for
the graph given below.
49.Find Minimum Spanning Tree for the given graph using Prim’s Algo.
Page3
Analysis & Design of Algorithms
Question Bank
50.Run Dijkstra’s algorithm on the directed graph of Figure 4.3.1, first using vertex s
as the source and then using vertex z as the source.
Figure 4.3.1
5 1.Find the Huffman code for each symbol in the following text.
52.ABCCDEBABFFBACBEBDFAAAABCDEEDCCBFEBFCAE.
53.Given 10 activities along with their start and finish time as
𝑆=<𝐴1, 𝐴2,𝐴3, 𝐴4, 𝐴5, 𝐴6,𝐴7,𝐴8,𝐴9, 𝐴10>
𝑆𝑖=<1,2,3,4,5,6,7,8,9,10>
𝑓𝑖=<5,3,4,6,7,8,11,10,12,13>
54.Run the Bellman-Ford algorithm on the directed graph of Figure 4.3.2, using
vertex z as the source.
igure 4.3.2
F
55.Solve the following Knapsack Problem using greedy methods. Number of items =
5,
56.knapsack capacity W = 100, weight vector = {50, 40, 30, 20, 10} and
profit vector = {1, 2, 3, 4, 5}.
Page4
Analysis & Design of Algorithms
Question Bank
64.Explain the Minimax principle and show its working for simple tic-tac-toe game
playing.
65.Show how depth-first search works on the graph of the following figure.
68.A newspaper agent daily drops the newspaper to the area assigned in such a
manner that he has to cover all the houses in the respective area within minimum
travel cost.
Compute the
minimum travel
cost. The area
assigned to the
agent where he has
to drop the
newspaper is
shown in the given
figure.
Page5
Analysis & Design of Algorithms
Question Bank
71.Let n=4(𝑃1, 𝑃2,𝑃3,𝑃4) = (100,10, 15, 27) and (𝑑1, 𝑑2,𝑑3, 𝑑4) = (2, 1, 2, 1)
where𝑃𝑖 are profits on processes or job and𝑑𝑖 are the deadline of
completion. Find the optimal schedule.
81.What is Finite Automata? Explain use of finite automata for string matching
with suitable examples.
82.Write pseudo-code for Naïve-String-Matching algorithm.
83.Explain Naive string matching algorithm with example.
84.Show the comparisons that naïve string matcher makes for the pattern
p=0001 in the text T=000010001010001
85.Explain rabin-karp string matching algorithm.
86.Explain spurious hits in the Rabin-Karp string matching algorithm with
example. Working modulo q=13, how many spurious hits does the
Rabin-Karp matcher encounter in the text T = 2359023141526739921 when
looking for the pattern P= 26739?
87.Use an aggregate analysis to show that the running time of
KMP-MATCHER is Ө(n)
.O.D
H Subject Teacher
s. Rauki Yadav
M Mr. Manish Singh
Page7