Daa QB
Daa QB
Daa QB
QUESTION BANK
UNIT-1
1. Define and explain the notion of Algorithm. Write an algorithm to find the GCD of two integer
numbers using (i)Euclid’s and (ii)Consecutive Integer Checking methods.
2. Design an algorithm to find the GCD of two numbers using Middle-School Procedure. Find the
GCD of 64 and 24 using the above method.
3. Design an algorithm to generate consecutive primes not exceeding the given integer.
4. With the aid of a neat flow chart, explain the process of Design and Analysis of Algorithms.
5. Design an algorithm to search for a key element using Sequential Search. Explain the best,
worst and average case time efficiencies of such an algorithm by deriving and ascertain the
order of growth for all the cases.
6. Outline the steps involved in Analysis framework of any algorithm.
7. Define Ο, Ω and θ with the help of Graphs depicting the order of growth.
8. List the basic asymptotic efficiency classes or Standard Functions. Give one example problem
for each of the efficiency classes.
9. Design an algorithm to find the maximum element in an array of n integers. Analyze the time
complexity of the same.
10. Design an algorithm to check if the elements in an array of n integers are unique. Analyze the
time complexity of the same.
11. Outline the general plan for analyzing the time efficiency of non-recursive algorithms. Write
an algorithm to multiply two square matrices of order n * n.
12. Design an (non-recursive and recursive) algorithm to find the number of binary digits in the
binary representation of a positive decimal integer.
13. Outline the general plan for analyzing the time efficiency of recursive algorithms with the
help of an algorithm to find the factorial of a number.
14. Design and analyze the algorithm to solve the towers of Hanoi puzzle
15. Illustrate with step by step procedure to search for a pattern in a given text for the following
problem using a string matching algorithm whose time efficiency O (nm).
Text: INCREDIBLE_INDIA
Pattern: INDIA
16. ALGORITHM Mystery (n)
S0
for i1 to n do
SS+i
return S
i) Describe the operation of algorithm.
ii) Identify its basic operation.
iii) Determine the number of times the basic operation executes.
iv) Label its efficiency class.
UNIT-2
1. Design and analyze the algorithm to solve the sorting problem using Bubble Sort.
2. Design and analyze the algorithm to solve the sorting problem using Selection Sort.
3. Solve the following recurrence relations using Master’s theorem. (i) T(n)=2T(n/2)+1 (ii)
T(n)=2T(n/2)+n
4. Design the algorithm to solve the Sequential Search Problem and String Matching Problem
using Brute Force.
5. Explain the General Method to solve the problems using Divide and Conquer Strategy.
6. Briefly explain the time efficiencies of Recursive Binary Search for both successful and
unsuccessful search
7. Design and analyze the algorithm to solve the sorting problem using Merge Sort.
8. Given 55 32 45 67 44 23 16 89. Depict the step by step pictorial procedure to sort these
numbers using Merge Sort.
9. Given 55 32 45 67 44 23 16 89. Depict the step by step pictorial procedure to sort these
numbers using Quick Sort.
10. Compare and contrast Merge Sort with Quick Sort.
11. Explain the performance analysis of Quick Sort by ascertaining its order of growth in best,
average and worst case.
12. Explain the General Method for solving any problem using Decrease and Conquer strategy.
13. Design and analyze the algorithm to solve the sorting problem using Insertion Sort and apply
on the given set
89 45 68 90 29 34 70
14. With the help of one example illustrate how Decrease and Conquer differs from Divide and
Conquer.
15. Get the BFS and DFS trees for the following DAG. (Let a be the source vertex).
a b c
d e f
16. Design the algorithms to perform BFS and DFS for a graph and apply algorithm for traversal
for the below graph
17. Compare and contrast BFS with DFS.
18. Design the algorithm to find the topological sequence of a DAG using Depth First Search.
19. Solve the following set of elements by applying a sorting technique which partition’s the array
based on the position of pivot element.
53198247
UNIT -3
1. Write the pseudo code for Kruskal’s algorithm and obtain a minimum cost spanning tree for
the graph given below.
2. Explain Warshall’s Algorithm and illustrate the step by step procedure to obtain the transitive
closure for the given graphs