Vous êtes sur la page 1sur 2

Design and Analysis of Algorithms

B. Tech. VII Term


Assignment 2 Last date of Submission : 15 November 2013 1. Discuss the classes P, NP, NP complete, and NP hard with examples. How can we show that a problem is NP complete. 2. Explain the uses of different Number theoretic algorithms by citing some examples. 3. Define Red Black Tree. Prove that a Red Black tree with n internal nodes has height at most 2 log (n+1). 4. What do you understand by amortized analysis? Explain any one algorithm. 5. What do you understand by Polynomial time reducibility? 6. What is the relationship between P, NP and NPC classes? 7. Use Floyd-Warshall Algorithm to find the shortest paths for all pairs of vertices in the given graph.

8. Apply Kruskal/Prim's algorithms to find the minimum spanning tree of the following graph.

9. Solve the following instance of the single source shortest path problem with vertex a as the source.

10. Find all solutions to 4-Queens and 8-Queens problem. Explain the process of backtracking in finding the solutions. 11. Draw a RB tree from the following set of elements: (23, 12, 24, 33, 2, 5, 6, 7, 43, 16) 12. Delete the element 24 from the above RB tree, and draw the tree after the deletion. 13. Insert 54 and 58 to the RB tree in question 28 and draw the respective RB trees. 14. Explain the Binomial/Fibonacci heap operations. 15. Show the comparisons the naive string matcher makes for the pattern P = 0001 in the text 16. T = 000010001010001. 17. Compute the prefix function for the pattern ababbabbabbababbabb when the alphabet is = {a, b}. 18. Write an algorithm to find the GCD and LCM of two integers a and b. What are the time complexities of your algorithm. 19. What is an optimal Huffman code for the following set of frequencies, based on the first 8 Fibonacci numbers? a:1 b:1 c:2 d:3 e:5 f:8 g:13 h:21 20. Construct the string-matching automaton for the pattern P = aabab and illustrate its operation on the text string T = aaababaabaababaab. 21. 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? ++++++++++++++++++

Vous aimerez peut-être aussi