15
Assignment: 1 Q.1 what do you mean by Analysis of Algorithm? Write an Algorithm For Insertion Sort and Analyze it. Q.2 Explain strassen’s Matrix Multiplication? Drive its time complexity why this better than ordinary Matrix Multiplication? Q.3 what is Greedy Approach? Does it always give optimal solution? Explain Kruskal’s algo to obtain MST. Q.4 Describe the various types of notations with example? Q.5 finds the optimal merge pattern for the given values 35, 15, 20, 40, 10 Q.6 illustrate the operation of min heap tree for given values

Daa Assignment

Embed Size (px)

DESCRIPTION

daa

Citation preview

Page 1: Daa Assignment

Assignment: 1

Q.1 what do you mean by Analysis of Algorithm? Write an Algorithm For Insertion Sort and Analyze it.

Q.2 Explain strassen’s Matrix Multiplication? Drive its time complexity why this better than ordinary Matrix Multiplication?

Q.3 what is Greedy Approach? Does it always give optimal solution? Explain Kruskal’s algo to obtain MST.

Q.4 Describe the various types of notations with example?

Q.5 finds the optimal merge pattern for the given values

35, 15, 20, 40, 10

Q.6 illustrate the operation of min heap tree for given values

10, 20, 30, 1, 2, 3, 4, 11, 21, 31, 41

Q.7 solves the following recurrence relations and find their complexities using Master Method.

Q.8 Express the following function using asymptotic notations:

(i) 6*2n + n2

(ii) ½*n(n-1)

Page 2: Daa Assignment

Class Test: 1

Q.1 What is the divide and conquer Method? Sort the following sequence using Merge Sort method

5, 2, 4, 7, 1, 3, 2, 6

Q2.consider the five items along with their respective values and weights.

I= {I1, I2, I3 , I4 , I5}

W= {5, 10, 20, 30, 40}

V= {30, 20, 100, 90, 16}

Knapsack has Capacity W=60. Find the optimal solution of the problem using concept of fractional Knapsack.

Q.3 Explain the job sequencing problem with example.

Q.4 Use strassen’s matrix multiplication algo to compute the matrix product of the following matrices:

A =

B =

7 9

2 5

3 2

5 5

Page 3: Daa Assignment

Assignment: 2

Q1. (a) Define how Knapsack Problem is solved by using dynamic programming approach?

(b) Consider n=3, (w1,w2, w3 ) = (2 , 3, 3 )

(p1, p2, p3) = (1, 2, 4) and M=6 find optimal solution for given data

Q.2 X= <a, a, b, a, b > , Y= <b, a, b, b > If Z is an LCS of X and Y, then find Z using Dynamic Programming.

Q.3 Solve the TSP Problem having the following cost matrix using Branch and Bound A B C D

X 10 15 205 X 9 106 13 X 128 8 9 X

A B C D

Q.4 Explain the matrix chain multiplication algorithm using dynamic approach.

Page 4: Daa Assignment

Q.5 find the order of parenthesization for the optimal chain multiplication

A1 = 30 * 35 ; A2 = 35 *15 ; A3 = 15 * 5;A4 = 5 * 10; A5 = 10 * 20 ; A6 = 20 * 25;

Q.6 Write short note on following:

(i) Backtracking algorithm

(ii) Lower bound theory

(iii) Queen’s problem

Q.7 use Dynamic programming approach to solve the following instance of the problem.

Maximum capacity: 11 unitsNo of items: 5Weights: 1, 2,5,6,7Profits: 1, 6, 18, 22, 28

Page 5: Daa Assignment

Class Test: 2

Q1. Solve the TSP Problem having the following cost matrix using Branch and Bound A B C D

X 5 2 34 X 2 34 2 X 37 6 8 X

A B C D

Q.2 X= <A, B, C, B, D, A, B > , Y= <B, D, C, A, B, A > If Z is an LCS of X and Y, then find Z using Dynamic Programming.

Q.3 Differentiate between Greedy algorithm and Dynamic Programming

Page 6: Daa Assignment

Assignment: 3

Q.1 Explain the prefix function for a String with an example and write KMP matcher algorithm?

Q.2 Write short note on the following:

(i) Quadratic assignment problem

(ii) Boyer Moore algorithm

Q.3 Describe Naïve string Matching algorithm in detail?

Q.4 Explain Rabin karp algorithm with suitable example?

Q.5 Using KMP algorithm find whether the pattern

P = < 10100111> is in text T= <1001010100111> or not?

Q.6 Solve the following assignment problem using branch and bound for which cost matrix is given below

1 2 3 4

Page 7: Daa Assignment

11 12 18 4014 15 13 2211 17 19 2317 14 20 28

A B C D

Class Test: 3Q.1 Perform Rabin Karp algorithm on given text

T= < 2, 3, 5, 9, 0, 2, 3, 1 4, 1, 5 >

P= < 3, 1, 4, 1, 5 > and modulo q=7

Q.2 Explain the Boyer Moore algorithm for pattern matching using bad character heuristic and good suffix heuristics with example?

Q.3 Write the KMP string matching algorithm and also find the prefix function for the following pattern : a b a b b a b a a andImplement the algorithm.

Page 8: Daa Assignment

Assignment: 4

Q1. Explain the Las Vegas and Monte Carlo algorithm with example?

Q.2. Explain the flow network and augmenting paths?

Q3.show the formation of cuts, augmentation path, min-flow-max-cut in the following graph.

Page 9: Daa Assignment

Class Test: 4

Q.1 define flow network and solve the following flow network for maximum flow.

Page 10: Daa Assignment

Q.2 what are the randomized algorithms? What are the advantages using this concept?

Q.3. Explain Randomized algorithm for Min cut.

Assignment: 5

Q1. What is the use of cook’s theorem? Prove it with example.

Q.2 define the terms P, NP, NP Complete and NP hard problems

Q.3 Explain set cover problem in detail?

Q.4 assuming 3- CNF satisfiability problem to be NP-Complete, prove that clique problem is also NP-complete problem.

Page 11: Daa Assignment

Class Test: 5

Q.1 Explain Vertex cover and set cover problem is NP-Complete problem.

Q.2 prove that TSP problem is NP –complete problem.

Q.3 Explain the relation between NP,NP-Complete , NP-hard problem

Page 12: Daa Assignment