10.07.2015 Views

Analysis and Design of Algorithms 2a. - Vtustudentsparadise

Analysis and Design of Algorithms 2a. - Vtustudentsparadise

Analysis and Design of Algorithms 2a. - Vtustudentsparadise

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

I <strong>of</strong>2USN06cs43Fourth Semester B.E. Degree Examination, May/June 2010<strong>Analysis</strong> <strong>and</strong> <strong>Design</strong> <strong>of</strong> <strong>Algorithms</strong>Time: 3 hrs.Note: Answer any FIVE full questions, selectingot least TWO questions from each part.Max. Marks:100la.<strong>2a</strong>.b.c.b.c-PART _ ACompare the orders <strong>of</strong> growth <strong>of</strong> log, (n) <strong>and</strong> 16-. What is your conclusion? (06 Marks)Define O-notation. If fr(n) e O(e,(r)) <strong>and</strong> fr(n) e O(gr(t )), prove thatfr (n) + f, (n) e O(max{g, (r), g, (r,)}).(06 Marks)Given a positive decimal integer n, write a recursive algorithm which computes the number<strong>of</strong> binary digits in the binary representation <strong>of</strong> n. Write the corresponding recurrence relation<strong>and</strong> solve it.(08 Marks)Explain the algorithm for selection sort. If A is ai array <strong>of</strong> size n, obtain an expression forthe number <strong>of</strong> key comparisons.(06 Marks)Using bubble sort algorithm, arrange the letters <strong>of</strong> the word 'QUESTION' in alphabeticalorder.(06 Marks)Show how divide <strong>and</strong> conquer technique can be used to compute the product <strong>of</strong> two n-digitintegers. If n is a power <strong>of</strong> 2, obtain a recurrence relation for M(n), the number <strong>of</strong>multiplications <strong>and</strong> solve it.(0E Marks)3b.c.What are the three major variations <strong>of</strong> decrease <strong>and</strong> conqueran example.Sort the letters <strong>of</strong> the word "EXAMPLE" in alphabetical orderDescribe the Johnson Trotter algorithm for generatingpermutations <strong>of</strong> {3, 5, 7} using the following:i) Bottom up minimal change algorithmii) Johnson Trotter algorithm.technique? Explain each with(06 Marksiusing insertion ron.,ouMarks)permutations. Generate all(0E Marks)4 a. Write an algorithm for DFS. With an example, explain horv this algorithm can be used tosolve topological sorting problem.(I0lllarks)b. Using quick sort, arrange the lefters <strong>of</strong> the word "QUICKSORT" in alphabetical order.Show all the steps elearly <strong>and</strong> draw the tree <strong>of</strong> the recursive calls made. (10 Marks)PART - B5 a. Define a2-3 tree. For any 2-3 tree <strong>of</strong> height h consisting <strong>of</strong> n nodes, prove the following:logr(n + l) - I h < logr(n + 1)-< - 1b. Describe the algorithm for heap sort.c. Show how Horspool's algorithm can be usedtext. Consider all the four cases.(06 Marks)(06 Marks)to search for the pattern BARBER in a given(08 Marks)


2 <strong>of</strong>?06cs,6a. Apply Warshall's algorithm t<strong>of</strong>ollowing adjacency matrix:(oll, olo ob.[ooUsing Floyd's algorithm, solveweight matrix is given below:Using Kruskal's algorithm,given below:06cO@Jobtainfind the transitive closure00\I 0lo tl0o)the all-pairs shortest path2@l032oo0 4a208@@Joo@@ 0a minimum<strong>of</strong> the graph defined by t(05 Marproblem for the graph whr(10 Marcost spanning tree for the graph Fig.Q((05 MarFig.Q6(c)7 a. Construct a Huffrnan code for the following data: (06 MaCharacter A B C D EProbabilitv 0.4 0.1 0.2 0.15 0.15Decode the text whose encoding is 100010111001010 using the above Huffinan code.b. Write short notes on P, NP <strong>and</strong> NP-complete problems. (06 Mac. Explain how backtracking is used for solving 4 -8a. Solve the fibllowine insknce <strong>of</strong>em lgngItem I 2 3 4Weieht 4 7 5 3Value $40 $42 $2s $i2b.The capacity <strong>of</strong> the knapsack iJ$i: l0.queens problem. Show the state space tr(0E Mabranch <strong>and</strong> bound algorithm:(08 MaWhen does collision occur in hashing? What are the different mechanisms used to resrcollisions?(04 MaWhat are decision trees? Explain how decision trees are used in sorting algorithms.,^ _ _ (08 Ma***,1.*

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!