ADA - Question - Bank

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

Shree Swaminarayan Institute of Technology

Computer/IT Engineering Department


Subject: Analysis and Design of Algorithms (3150703) Semester-5th
Question Bank
Unit-1 & 2
1 What is an algorithm? Explain various properties of an algorithm
2 What is an algorithm? How does it differ from flowchart?
3 Define Algorithm, Time Complexity and Space Complexity.
4 Define Algorithms. Discuss key characteristics of algorithm
5 (i)Explain why analysis of algorithms is important? Explain: Worst Case, Best Case &
Average Case Complexity.
(ii) Define: Optimal Solution, Feasible solution, Principle of Optimality.
6 Arrange the following rate of growth in increasing order. 2N, n log n, n2, 1 , n, log n, n!, n3
7 Explain Asymptotic notation. Arrange the growth rate of 2 n , n 2 , 1, log n, n logn, 3 n and
n in increasing order of growth.
8 Write an algorithm of Selection Sort Method. Give its best case, worst case and average case
complexity.
9 What do you mean by Asymptotic Notations? Explain.
10 Define :Big Oh, Big Omega and Big Theta Notation.
11 Solve the recurrence T(n) = 7T(n/2) + n 3
12 Write the best and worst running time of Insertion sort algorithm. Why does it differ?
13 Sort the letters of word “EXAMPLE” in alphabetical order using insertion sort.
14 Analyze Selection sort algorithm in best case and worst case.
15 Write the Master theorem. Solve the following recurrence using it.
(i) T(n)=9T(n/3) + n (ii) T(n)=3T(n/4) + nlgn
16 Use Iteration method to solve recurrence T(n) = T(n-1) + 1 , here
T(1)= Ө(1).
17 Explain Bubble sort algorithm. Derive the algorithmic complexity in Best case, worst case
and average case analysis.
18 Solve following recurrence using master method T(n) = 9T(n/3) +n
19 Let f(n) and g(n) be asymptotically nonnegative functions. Using the basic definition of Θ-
notation, prove that max(f(n), g(n)) = Θ (f(n) + g(n)).
20 Find out the Θ -notation for the function: f(n)=27n2 +16n.
21 Solve the following recurrence relation using the iteration method. T(n) = 8T(n/2)+ n 2 . Here
T(1) = 1.
OR
Solve the following recurrence relation using the substitution method. T(n) =2T(n/2) + n.
Here T(1) = 1.
22 Prove or disprove that f(n) = 1 + 2 + 3 + .... + n ∈ Θ(n^2).
23 Which are the basic steps of counting sort? Write a counting sort algorithm. Derive its time
complexity in the worst case.
24 Solve the following recurrence using the recursion tree method: T(n) = 3T(n/3) +n^3.
25 What is an amortized analysis? Explain aggregate method of amortized analysis using suitable
example.
26 Explain the heap sort in detail. Give it complexity.
27 Explain Tower of Hanoi Problem, Derive its recursion equation and computer it’s time
complexity.
Unit 3
1 Define an amortized analysis. Briefly explain its different techniques. Carry out aggregate
analysis for the problem of implementing a k-bit binary counter that counts upward from 0.
2 Analyze quick sort algorithm for best case, average case and worst case with example.In
which case it performs similar to selection sort?
3 Discuss matrix multiplication problem using divide and conquer technique.
4 Write a program/algorithm of Merge Sort Method. What is Complexity of it?
5 Explain the use of Divide and Conquer Technique for Binary Search Method.What is the
complexity of Binary Search Method? Explain it with an example.
6 Demonstrate Binary Search method to search Key = 14, form the array
A=<2,4,7,8,10,13,14,60> .
7 Write Merge sort algorithm and compute its worst case and best-case time complexity. Sort
the List G,U,J,A,R,A,T in alphabetical order using merge sort.
Unit 4
1 What are the differences between greedy approach and dynamic programming?
2 What are the steps for dynamic programming? Explain principal of optimality.
3 What are the advantages of dynamic programming methods over divide-&-conquer methods?
4 Give difference of dynamic programming and divide-and-conquer method.
5 Discuss and derive an equation for solving the 0/1 Knapsack problem using dynamic
programming methods. Design and analyze the algorithm for the same.
6 Discuss Assembly Line Scheduling problem using dynamic programming with examples.
7 Solve Making change problems using dynamic technique. d1 = 1, d2=2,d3=4, d4=6, Calculate
for making change of Rs. 10.
8 Explain Chained Matrix Multiplication with an example.
9 Explain how to find out the Longest Common Subsequence of two strings using Dynamic
Programming method. Find any one Longest Common Subsequence of given two strings
using Dynamic Programming. X=abbacdcba, Y=bcdbbcaac
10 Solve Making Change problem using Dynamic Programming. (Denominations: d1=1, d2=4,
d3=6). Give your answer for making change of Rs. 9.
11 Explain Strasson’s algorithm for matrix multiplication.
12 Explain how to find out the Longest Common Subsequence of two strings using a dynamic
programming method. Find the Longest Common Subsequence of given two strings S1 =
10010101 and S2 = 010110110
13 Solve the following making change problem using dynamic programming method: Amount
= Rs. 7 and Denominations: (Rs. 1, Rs. 2 and Rs. 4)
14 For the following chain of matrices find the order of parameterization for the optimal chain
multiplication (13,5,89,3,34).
15 Using dynamic programming find out the optimal sequence for the matrix chain
multiplication of A 4x10 , B 10x3 , C 3x12 , D 12x20 and E 20x7 matrices.
Unit 5
1 Define Minimum Spanning Tree(MST). Explain Krushkal’s Algorithm to find MST with an
example.
2 Explain Prim’s Algorithm to find Minimum Spanning Tree with an example. What is its Time
Complexity?
3 Explain the characteristics of Greedy algorithms. Compare Greedy algorithms with Dynamic
Programming Method giving example of Knapsack Problem.
4 Explain general characteristics of greedy algorithms.
5 Explain: Acyclic Directed Graph, Articulation Point, Dense Graph, Breadth First Search
Traversal, Depth First Search Traversal.
6 Write the Prim’s Algorithm to find out Minimum Spanning Tree. Apply the same and find
MST for the graph given below.

7 Solve following knapsack problem using dynamic programming algorithm with given
capacity W=5, Weight and Value are as follows : (2,12),(1,10),(3,20),(2,15)
8 Explain: Acyclic Directed Graph, Articulation Point, Dense Graph, Breadth First Search
Traversal, Depth First Search Traversal.
9 Consider Knapsack capacity W=50, w=(10,20,40) and v=(60,80,100) find the maximum
profit using a greedy approach.
10 Find an optimal Huffman code for the following set of frequency. a : 50, b: 20, c: 15, d: 30.
11 Generate minimum spanning tree using Kruskal's algorithm for the following graph.

12 Consider Knapsack capacity W=9, w = (3,4,5,7) and v=(12,40,25,42)


find the maximum profit using a dynamic method.
13 Find out the NCR ( )Using Dynamic Method.
14 Find out LCS of A={K,A,N,D,L,A,P} and B = {A,N,D,L}
15 Explain the Principle of Optimality with an example.
16 Determine LCS of {1,0,0,1,0,1,0,1} and {0,1,0,1,1,0,1,1,0}
17 Explain 0/1 knapsack using suitable example
18 Define spanning tree and MST. How Krushkal’s algorithm is different from Prim’s
algorithm.
19 Explain fractional knapsack problem with an example.
Unit 6
1 Explain Depth First Traversal Method for Graph with algorithm with example.
2 Explain Breadth First Traversal Method for Graph with algorithm with example.
3 Explain Dijkstra algorithm to find the shortest path
4 Find single source shortest path using Dijkstra’s algorithm from a to e.

5 Solve all pair shortest path problem for the following graph using Floyd's algorithm.
6 Find all pair of shortest path using Floyd’s Algorithm for given graph

7 What is DFS? Explain with example. Show the ordering of vertices produced by Topological-
sort for the following graph.

8 Find out the Minimum Spanning Tree using Kruskal Algorithm for a given Graph.

9 Explain: Articulation Point, Graph, Tree


10 Define BFS. How it differs from DFS.
11 Explain DFS algorithm in brief.
12 Define graph, complete graph and connected graph.
13 Write and explain the Dijkstra algorithm with an example.

Unit 7
1 Explain Backtracking Method. What is the N-Queens Problem? Give solution to 4- Queens
Problem using Backtracking Method.
2 Explain use of Branch & Bound Technique for solving Assignment Problem.
3 Explain Backtracking Method. What is the N-Queens Problem? Give solution to 4-Queens
Problem using Backtracking Method.
4 Differentiate branch and bound and backtracking algorithm.
5 Solve the following instance of knapsack problem using Backtracking Technique. The
Capacity of the Knapsack W = 8 and w = (2,3,4,5) and value v = (3,5,6,10)
6 Draw the state space tree Diagram for 4 Queen problem.
7 Write just steps for Backtracking and Branch-and-Bound algorithms.
Unit 8
1 What is a finite automata? Explain with example how a finite automaton is used for string
matching?
2 Explain spurious hits in 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 = 31415?
3 What is Finite Automata? Explain use of finite automata for string matching with suitable
example.
4 Explain naïve string matching algorithm with example.
5 Explain finite automata algorithm for string matching.
6 What is the string-matching problem? Define valid shift and invalid shift.
7 Write pseudo-code for Naïve-String-Matching algorithm.

Unit 9
1 Define P, NP, NP-Hard and NP-Complete Problem.
2 Explain in Brief: P Problem, NP Problem, NP Hard Problem, NP Complete Problem
3 Travelling Salesman Problem, Recurrence Equations, Relation, Approximation Algorithms.
4 What is Recursion? Give a Recursive algorithm for the Tower of Hanoi Problem and give
analysis of it.
5 What is recurrence? Explain recursion-tree method with suitable example.

6 Explain “P = NP ?” problem.
7 Explain travelling salesman problems. Prove that it is NP complete problem.

Prepared By
Prof. Kamlesh Singh
Asst. Prof. IT Dept.

You might also like