DAA Question Bank
DAA Question Bank
Tircuchirappalli
QUESTION BANK
Regulation : 2021
Academic Year : 2023-2024
QUESTION BANK
CO 1. Apply efficient algorithms to reduce space and time complexity of both recurrent and non-
recurrent relations
CO 2. Solve problems using divide and conquer approaches
CO 3. Apply greedy and dynamic programming types techniques to solve polynomial time
problems.
CO 4. Create exponential problems using backtracking and branch and bound approaches.
CO 5. Interpret various approximation algorithms and interpret solutions to evaluate P type, NP
Type, NPC, NP Hard problems
UNIT I
While solving the problem with computer the most difficult step is
______.
A. describing the problem
2
B. finding out the cost of the software
C. writing the computer instructions
CO 1 BT 1
D. testing the solution
Answer:- C
If the address of A[1][1] and A[2][1] are 1000 and 1010 respectively
and each element occupies 2 bytes then the array has been stored in
order.
15
A. row major
B. column major
CO 1 BT 1
C. matrix major
D. none of these
Answer A
Which one of the following is the tightest upper bound that represents
the number of swaps required to sort n number using selection sort?
A. (log n)
18
B. O(n)
C. (n log n)
CO 1 BT 1
D. O(n2)
Answer:-B
How many comparisons are needed for linear Search array when
elements are in order in best case?
A. 1
19
B. n
C. n+1
CO 1 BT 1
D. n-1
Answer A
}
A. O(n)
B. O(nlogn)
C. O(n2)
D. O(2n)
Answer:D
A function in which f(n) is Ω(g(n)), if there exist positive values k and c
such that f(n)>=c*g(n), for all n>=k. This notation defines a lower
bound for a function f(n):
26
A. Big Omega Ω (f)
B. Big Theta θ (f)
CO 1 BT 1
C. Big Oh O (f)
D. Big Alpha α (f)
Answer A
The concept of order Big O is important because_______
A. It can be used to decide the best algorithm that solves a given problem
B. It determines the maximum size of a problem that can be solved in a
27
given
amount of time
CO 1 BT 1
C. It is the lower bound of the growth rate of algorithm
D. Both A and B
Answer A
The upper bound on the time complexity of the nondeterministic
sorting algorithm is
A. O(n)
28
B. O(n log n)
C. O(1)
CO 1 BT 1
D. O( log n)
Answer: A
30
B. O(n)
C. O(n log n)
1/2
CO 1 BT 1
D. O(log n)
Answer C
PART B (4 Marks)
1 Explain Analysis Framework of algorithm with Suitable Example. CO1 BT 2
CO1 BT 2
CO1 BT 3
4
X(n)=x(n-1) + 5 for n>1, x(1) = 0
CO1 BT 3
5 Write the algorithm for finding element uniqueness and analyse its
efficiency.
CO1 BT 2
2 Write the algorithm for matrix multiplication and analyse its efficiency.
Solve the recurrence relation T(n)=7T(n/2)+18n 2 and find the time CO1 BT 3
complexity.
3
Design a recursive algorithm to compute the factorial function F(n) =n! for CO1 BT 2
an arbitrary non negative integer n and set up a recurrence equation for the
number of multiplication made by the algorithm.
4
CO1 BT 2
Introduction-Divide and Conquer - Maximum Subarray Problem - Binary Search - Complexity of binary search Merge
sort - Time complexity analysis -Quick sort and its Time complexity analysis Best case- Worst case- Average case
analysis - Strassen's Matrix multiplication and its recurrence relation - Time complexity analysis of Merge sort -
Largest sub-array sum - Time complexity analysis of Largest subarray sum - Master Theorem Proof - Master theorem
examples - Finding Maximum and Minimum in an array - Time complexity analysis-Examples - Algorithm for finding
closest pair problem – Convex Hull problem
Which of the following is not the required condition for binary search
algorithm?
A. The list must be sorted
2
B. There should be the direct access to the middle element in any sub list
C. There must be mechanism to delete and/or insert elements in list. CO 2 BT 1
D. Number values should only be present
ANSWER: C
Which of the following sorting algorithm is of divide and conquer
type?
A. Bubble sort
3
B. Insertion sort
C. Merge sort CO 2 BT 1
D. Selection sort
ANSWER: C
____________order is the best possible for array sorting algorithm
which sorts n item.
A. O (n logn)
4
B. O (n2)
C. O (n+logn) CO 2 BT 1
D. O (logn)
ANSWER: C
The complexity of merge sort algorithm is __________
A. O (n)
B. O (logn)
5
C. O (n2)
D. O (n logn)
CO 2 BT 1
ANSWER: D
13 How many sub arrays does the quick sort algorithm divide the
entire array into?
a) one CO 2 BT 1
b) two
c) three
d) four
ANSWER: B
21 What is the result of the recurrences which fall under first case
of Master’s theorem (let the recurrence be given by
CO 2 BT 1
T(n)=aT(n/b)+f(n) and f(n)=nc?
a) T(n) = O(n^logba)
b) T(n) = O(nc log n)
c) T(n) = O(f(n))
d) T(n) = O(n2)
ANSWER: A
PART B (4 Marks)
1 Formulate the Binary Search Algorithm and analyze its worst, best and CO2 BT 3
average case time complexity.
CO2 BT 3
2 Consider that there were two list of sorted array. Propose the algorithm for
combining the elements of two arrays into single array in sorted order.
Solve the maximum sub array sum in a pictorial way by drawing tree. CO2 BT 3
CO2 BT 3
4 Write an algorithm for finding maximum sub array sum and analyse its
efficiency.
CO2 BT 2
CO2 BT 2
7 Write short notes on Master theorem usage in the time complexity analysis.
CO2 BT 3
8 Develop the algorithmic steps to find the maximum and minimum element
in the given list and analyse its efficiency.
CO2 BT 2
1 Consider example of your choice and find the Closest pair among the
considered number. Devise an algorithm and analyze its efficiency.
CO2 BT 2
2 Explain the Convex Hull problem and analyze the time complexity of the
algorithm.
Write an algorithm for binary search and analyse its time complexity with CO2 BT 2
suitable examples.
3
Write an algorithm for quick sort and analyse its time complexity with CO2 BT 2
suitable examples.
4
Write an algorithm for merge sort and analyse its time complexity with CO2 BT 3
suitable examples 6 5 12 10 9 1 8 6
5
CO2 BT 3
A= .
B=
Note:
1. BT Level – Blooms Taxonomy Level
2. CO – Course Outcomes
BT1 – Remember BT2 – Understand BT3 – Apply BT4 – Analyze BT5 – Evaluate BT6 – Create