Sie sind auf Seite 1von 3

1.What is Divide and Conquer? Divide-and-conquer algorithms are naturally implemented as recursive procedures.

In that case, the partial sub-problems leading to the one currently being solve d are implicitly stored in the procedure call stack. 2. Mention the three steps in Divide and conquer algorithm ? Divide the problem into a number of sub problems. ? Conquer the sub problems by solving them recursively. If the sub problem sizes are small enough, however, just solve the sub problems in a straightforward man ner. ? Combine the solutions to the sub problems into the solution for the original p roblem. 3. Is it possible to implement Divide and Conquer in Non-recursive? Yes,D&C solutions can also be implemented by a non-recursive algorithm that stor es the partial sub-problems in some explicit data structure, such as a stack, qu eue, or priority queue. 4.Give 2 examples for dive and conquer non-recursive approach breadth-first recursion branch and bound 5. Advantages of Divide and Conquer Algorithm Solving difficult problems ,Algorithm efficiency ,Parallelism,Memory access,Roun doff control. 6. Disadvantages of Divide and Conquer Algorithm ? Conceptual difficulty ? Recursion overhead ? Repeated subproblems 7. Define Quick Sort Quick sort is an algorithm of choice in many situations because it is not diffic ult to implement, it is a good \"general purpose\" sort and it consumes relative ly fewer resources during execution. 8. List out the Advantages in Quick Sort It is in-place since it uses only a small auxiliary stack. It requires only n log(n) time to sort n items. It has an extremely short inner loop This algorithm has been subjected to a thorough mathematical analysis, a very pr ecise statement can be made about performance issues. 9.List out the Disadvantages in Quick Sort It is recursive. Especially if recursion is not available, the implementation is extremely complicated. It requires quadratic (i.e., n2) time in the worst-case. It is fragile i.e., a simple mistake in the implementation can go unnoticed and cause it to perform badly. 10.What is Binary Search Tree? Binary Search tree is a binary tree in which each internal node x stores an elem ent such that the element stored in the left subtree of x are less than or equal to x and elements stored in the right subtree of x are greater than or equal to x. This is called binary-search-tree property. 11. Define Height of BST The height of the Binary Search Tree equals the number of links from the root no de to the deepest node.

12. Define Greedy Algorithms Greedy algorithms are simple and straightforward. They are shortsighted in their approach in the sense that they take decisions on the basis of information at h and without worrying about the effect these decisions may have in the future. 13.Mention the four functions in Greedy Algorithm 1. A function that checks whether chosen set of items provide a solution. 2. A function that checks the feasibility of a set. 3. The selection function tells which of the candidates is the most promising. 4. An objective function, which does not appear explicitly, gives the value of a solution. 14. Define of feasibility A feasible set (of candidates) is promising if it can be extended to produce not merely a solution, but an optimal solution to the problem. 15. Define Dijikstra Algorithm Dijkstra\'s algorithm solves the single-source shortest-path problem when all ed ges have non-negative weights 16. How can we implement the Binary Search Tree? Binary Search Tree can be implemented as a linked data structure in which each n ode is an object with three pointer fields. The three pointer fields left, right and p point to the nodes corresponding to the left child, right child and the p arent respectively NIL in any pointer field signifies that there exists no corre sponding child or parent. The root node is the only node in the BTS structure wi th NIL in its p field. 17.Define Analysis of Binary Search? Binary Search can be accomplished in logarithmic time in the worst case , i.e., T(n) = ?(log n). This version of the binary search takes logarithmic time in the best case. 18.Define Randomized Quick Sort In the randomized version of Quick sort we impose a distribution on input. The n ew partition procedure, simply implemented the swap before actually partitioning . 19.List the Steps in Merge Sort 1. Divide Step If given array A has zero or one element, return S; it is already sorted. Otherw ise, divide A into two arrays, A1 and A2, each containing about half of the elem ents of A. 2. Recursion Step Recursively sort array A1 and A2. 3. Conquer Step Combine the elements back in A by merging the sorted arrays A1 and A2 into a sor ted sequence 20.List out the 4 steps in Strassen s Method? 1. Divide the input matrices A and B into n/2 * n/2 submatrices, as in equation (1). 2. Using T(n2) scalar additions and subtractions, compute 14 n/2 * n/2 matrices A1, B1, A2, B2, , A7, B7. 3. Recursively compute the seven matrix products Pi =AiBi for i =1, 2, 7. 4. Compute the desired submatrices r, s, t, u of the result matrix C by adding a nd/or subtracting various combinations of the Pi matrices, using only T(n2) scal ar additions and subtractions.

16 Marks

1. Write Short note on Dijkstra\'s Algorithm 2.Explain Kruskal\'s Algorithm 3.Discuss Prim\'s Algorithm 4.Write short note on Greedy Method 5.Explain Strassen s Algorithm 6.Discuss Binary Tree Traversal 7.Explain Binary Search 8.Discuss Quick Sort 9.Write short on Merge Sort 10.Explain Divide And Conquer Method

Das könnte Ihnen auch gefallen