7
DESIGN AND ANALYSIS OF ALGORITHMS (10CS43) QUESTION BANK UNIT 1 1. Explain notion of algorithm. Write Euclid’s algorithm for computing gcd(m,n). 2. Write and explain the steps of algorithm problem solving using flowchart. 3. Define weighted graph. Give example and write its adjacency matrix 4. Explain the orders of growth and basic efficiencies classes of algorithms 5. Write and find the worst-case, best- case and average case efficiency of sequential- search algorithm. 6. Explain the mathematical analysis of Fibonacci sequence recursive algorithms. 7. Explain brute- force algorithm design, strategy. Design analyzes bubble – sort algorithm, with example. 8. Explain the algorithm for selection sort. If A is an array of size n, obtain an expression for number of key comparisons. 9. Using bubble sort algorithm, arrange the letters of word “QUESTION” in alphabetical order. UNIT 2

ADA QB

Embed Size (px)

DESCRIPTION

adapit

Citation preview

Page 1: ADA QB

DESIGN AND ANALYSIS OF ALGORITHMS (10CS43)

QUESTION BANK

UNIT 1

1. Explain notion of algorithm. Write Euclid’s algorithm for computing gcd(m,n).

2. Write and explain the steps of algorithm problem solving using flowchart.3. Define weighted graph. Give example and write its adjacency matrix4. Explain the orders of growth and basic efficiencies classes of algorithms5. Write and find the worst-case, best- case and average case efficiency of

sequential- search algorithm.6. Explain the mathematical analysis of Fibonacci sequence recursive

algorithms.7. Explain brute- force algorithm design, strategy. Design analyzes bubble –

sort algorithm, with example.8. Explain the algorithm for selection sort. If A is an array of size n, obtain

an expression for number of key comparisons.9. Using bubble sort algorithm, arrange the letters of word “QUESTION”

in alphabetical order.

UNIT 2

1. Explain the divide and conquer technique. Design and analyze quick sort algorithm, with example

2. Show divide and conquer technique can be used to compute the product of two n-digit integers. If n is a power of 2, obtain a recurrence relation for M(n), the number of multiplications and solve.

3. Suggest a pseudocode for merge sort and analyze its complexities. Trace algorithm to the data set 8, 4,1,6,7,2,3,9.

4. State binary search algorithm analyzes its complexity.

Page 2: ADA QB

UNIT 3

1. Write and explain prim’s algorithm and apply Prim’s algorithm for the following graph.

2. Write and explain Dijkstra’s algorithms and apply the algorithm for the following graph

Page 3: ADA QB

3. Apply the greedy technique for the following instance of the knapsack problem and solve.

Item Weight Valve1 2 $122 1 $103 3 $204 2 $15

4. Using kruskal’s algorithm, obtain a minimum cost spanning tree for the graph given below.

5. What are the requirements to be satisfied to apply greedy technique? Explain prim’s algorithm with a suitable example.

6. State and explain dijkstra’s algorithm to find single source shortest path.7. Explain job sequencing with deadlines using greedy method.

UNIT 4

1. Explain general method for dynamic programming.2. Differentiate between greedy method and dynamic programming.3. Write and explain Floyd’s algorithm for the all pairs shortest paths

problem, with example.4. Apply warshall’s algorithm to find the transitive closure of the digraph

defined by the following adjacency matrix.0 1 0 0

Page 4: ADA QB

0 0 1 0

0 0 0 1

0 0 0 0

5. Explain travelling salesmen problem using dynamic programming.6. Apply the dynamic programming following instance of the knapsack

problem and solve.

Item Weight Valve1 2 $122 1 $103 3 $204 2 $15

UNIT 5

1. Write and explain DFS and BFS algorithm, with example.2. Write an algorithm for DFS. With example, explain how this algorithm

can be used to solve topological sorting problem.3. Sort the letters of the word “EXAMPLE” in an alphabetical order using

insertion sort.4. What are the three major variations of decrease and conquer technique?

Explain each with example.5. Suggest an algorithm for generating combinational objects based on

decrease and conquer methodology.6. Explain the sorting by counting. Write algorithm comparison counting

sort. Sort the list {62, 31, 84, 96, 19, 47}.7. Show how horspool’s algorithm can be used to search for pattern

BARBER in a given text. Consider all the four cases.8. Construct the shift table for the pattern BAOBAB, and search for same in

the text BESS-KNEW-ABOUT-BAOBABS, using horspool’s algorithm.

Page 5: ADA QB

UNIT 6

1. Write a note on P, NP and NP-complete problems.2. Define NP-complete problem. Prove that the Hamilton circuit problem is

polynomial reducible to decision version of TSP.3. What is a decision tree? Use decision trees to establish lower bound on

worst-case and average – case efficiency of comparison based sorting algorithm.

4. Write down the decision tree for the three-element insertion sort.5. What is need for approximate algorithms? Explain , with a suitable

example, the nearest neighbor algorithm.6. Define decision tree. Write decision tree for finding minimum of 3

numbers.

UNIT 7

1. Explain how backtracking is used for solving 4 queens problem. Show the state space tree.

2. What is back tracking? Explain its usefulness with help of an algorithm. What are specific areas of its applications?

3. Explain the subset sum problem, with example using backtracking method.

4. Explain travelling salesmen problem with example using backtracking method.

5. Explain the travelling salesman problem with example using branch – bound method.

6. What is a C – approximation algorithm? Write a 2- approximation algorithm for TSP with Euclidian distances.

7. If P ≠ NP, prove that there exists no C – approximation algorithm for TSP.

UNIT 8

1. Explain computational model with example.2. Write parallel algorithm for prefix computation.3. Write a note on

a. Graph problemsb. List ranking.