Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

IMS Engineering College, Ghaziabad

Question Bank
Design & Analysis of Algorithm (KCS503)
B.Tech – 3yr (CS1 & CS2)

Unit-I

Q.1. Using master method, find the asymptotic bound for the following recurrences
 T (n) = 5T (n/4) + n2
 T (n) = 9T (n/3) + n
 T (n) = 4T (n/2) + n2
 T (n) = 4T(n/3)+n2
 T (n) = 3T(n/3) + log3n
Q.2. Write an algorithm for BUILD MAX HEAP.
Q.3. Define complexity of an algorithm. In how many cases you define complexity?
Q.4. what is an algorithm? Discuss the way to designing the algorithm.
Q.5. Why always we consider the complexity in terms of Big “O” notation?
Q.6. Rank the following by growth rate:
n, 2lg √n, log n, log (logn), log2n, (lgn)lgn, 4, (3/2)n, n!
Q.7. Show the steps in heap-sort to arrange following data in non-decreasing order <1, 2, 5, 6, 9, 8, 7>
Q.8. Sort the array <6,14,3,25,2,10,20,3,7,6> using counting sort technique.
Q.9. what do you mean by algorithm? Write the characteristics of algorithm.
Q.10. why we need asymptotic notation? Describe each with clear diagram.
Q.11. Using the radix sort techniques sort the given list of elements L = < 599, 875, 344, 375, 399, 489,
498 >
Q.12. Sort the element of the given array, using shell sort algorithm A = <20, 35, 18, 8, 14, 41, 3, 39>
Q.13. Write an algorithm for Quick Sort.
Q.14. Write down Heap sort algorithms in details and also gives an example of MAX-HEAPIFY?
Q.15. Sort the array <5,8,3,9,2,10,1,45,32> using heap sort techniques?
Q.16. Write the names of various design techniques of algorithrn.
Q.17. Explain the concept of merge sort with example.
Q.18. Illustrate the operation of Quick sort on the array, A= (9, 14, 87, 4, 32, 86, 67).
Q.19. Write an algorithm for counting sort? Illustrate the operation of counting sort on the following array
A = {4, 0, 2, 0, 1, 3, 5, 4, 1, 3, 2, 3}
Q.20. what do you understand by stable and unstable sorting? Sort the following sequence {25, 57, 48,
36, 12, 91, 86, 32} using heap sort.
Q.21. Use a recursion tree to give an asymptotically tight solution to the recurrence T(n) = T(αn) + T((1 -
α)n) + cn, where α is a constant in the range 0 <α< 1 and c> 0 is also a constant.

Unit-II
Q.1. Difference between Complete Binary Tree and Binary Tree?
Q.2. Insert the following information F, S, Q, K, C, L, H, T, V, W, M, R, N, P, A, B, X, Y, D, Z, E, G, I
into an empty B-tree with degree t=3.
Q.3. what is Red-Black tree? Write an algorithm to insert a node in an empty red-black tree explain with
suitable example.
Q.4. Describe various properties of binomial tree.
Q.5. Explain RB Tree properties, write left or right rotation algorithm, prove that a RB Tree with n
internal nodes has height at most 2log2(n+1).
Q.6. Explain insertion in red- black tree. Show steps for inserting 9,8,7,6,5,4,3,2,1 into empty RB Tree.
Q.7. Explain insertion in red-black tree. Show steps for inserting 1, 2, 3, 4, 5, 6, 7, 8 & 9 into
empty RB tree.
Q.8. Write algorithm for union of two binomial heaps. What is complexity?
Q.9. Insert the nodes 15, 13, 12, 16, 19, 23, 5, 8 in empty Red Black Tree and delete in the reverse order
of insertion.
Q.10. Discuss the advantages of using B-Tree. Insert the following Information 86, 23, 91, 4,
67, 18, 32, 54, 46, 96, 45 into an empty B-Tree with degree t=2 and delete 18, 23 from it.
Q.11. Insert the following element in an initially empty RB-Tree 12, 9, 81, 76, 23, 43, 65, 88, 76, 32, 54.
Now Delete 23 and 81.
Q.12. How will you sort following array A of elements using heap sort A = (23, 9, 18, 45, 5, 9, 1, 17, 6).

Unit-III
Q.1. discuss greedy approach to an activity selection problem of scheduling several competing activities.
Solve the following activity selection problem
S={A1,A2,A3,A4,A5,A6,A7,A8,A9,A10}Si={1,2,3,4,7,8,9,9,11,12} Fi={3,5,4,7,10,9,11,13,12,14}
Q.2. Write & explain Dijkstra's algorithm single source shortest path. Also apply it on the following
graph.

Q.3. Find the subsets-of sum of following problem. Given total elements are S= {4, 2, 7, 6, 8} and
maximum SUM is (X) = 8.
Q.4. Find an optimal parenthesization of a matrix chain product whose sequence of dimensions
are {10, 5, 3, 12, 6}.
Q.5. what do you mean by MST? Apply kruskal’s algo to find out minimum spanning tree for following
graph.
Q.5. write down Prim’s algorithm? Also apply it on the following graph.

Q.6. Generate MST for the following graph using prim’s algorithm:

Q.6. Use Strassen’s algorithm to compute the matrix product.


1 3 8 4

5 7 6 2

Why we use chain matrix multiplication? Find out an optimal sequence of matrices
P3x7 Q7x4 R4x3

Unit-IV
Q.1. Write an algorithm for Sum Subset problem using backtracking approach. Find all possible solution
for the following instances using same if m=30, S = <1, 2, 5, 7, 8, 10, 15, 20, 25>.
Q.2. Explain dynamic programming. How it is different with greedy approach?
Q.3. Write short notes on the following: i) Graph Coloring ii) Hamiltonian Cycles.
Q.4. Show the solution of 4-queen problem using backtracking.
Q.5. Consider 5 items along their respective weights and values
I=<I1, I2, I3, I4, I5> W=<5, 10, 20, 30, 40> V=<30, 20, 100, 90, 160> the capacity of Knapsack w=60.
Find the solution to the fractional knapsack problem.
Q.6. Discuss knapsack problern with respect to dynamic programming approach. Find the optimal
solution for given problem w= {5, 10, 15, 20} and W=8. Consider I=<I1,I2,I3>; W=<5,4,3>; V=<6,5,4>
and W=7, we have to pack this knap-sack using the branch and bound technique.
Q.7. Define Floyd warshall Algorithm for all pair shortest path and apply the same on following graph:
Q.8. Apply the (Dijkastra’s) greedy single source shortest path algorithm on the following graph:

Q.9. Consider following instance for simple knapsack problem. Find the solution using greedy method for
N:8
P : { I 1,21, 31, 33, 43, 53,55, 65}
W : {1, I l, 21,23,33, 43, 45, 55}
M: 110
Q.10.What is graph coloring problem? What do you mean by optimal coloring of graph? Show that every
bipartite graph is 2- colorable.
Q.11. Define Floyd Warshall Algorithm for all pair shortest path and apply the same on
following graph:

Unit-V
Q.1. Discuss KMP string matching algorithm and also find the prefix function for the following pattern:
ababbabaa.
Q.2. Define approximation algorithms. What is approximation ratio? Approximate the travelling salesman
problem with triangle inequality.
Q.3. what is the application of Fast Fourier Transform (FFT)? Also write the recursive algorithm for FFT.
Q.4. Explain the P, NP, NP Hard and NP- complete in decision problems.
Q.5. Explain KMP algorithm. Find the prefix function for the pattern P: ababaaca and apply KMP
algorithm on Text T: aabbababaacaab
Q.6. Write an algorithm of Naïve Matching and implement it by any example.
Q.7. Working modulo q=13, how many superious hit does the Rabin-Karp matcher encounter in the text
T=2359023141526739921 when looking for the pattern p=31415
Q.8. Discuss string matching algorithm. Explain naïve string matching algorithm for the text
T=abcaabccaabbabca and pattern P=abc.
Q.9. compute the prefix function for the pattern ababababca, when the alphabet is (a,b).
Q.10. working modulo q=11, how many spurious hits does the Rabin Karp matcher encounter in the text
T=3141592653589793 when looking for the pattern p=26.

You might also like