Académique Documents
Professionnel Documents
Culture Documents
Section A
1. Brief about the internal nodes in optimal binary search tree
In obtaining a cost function for binary search tree, it is useful to add fictitious node at the place of every empty sub-tree in the search tree. Such nodes are called external nodes. All other nodes are called internal nodes.
10. Differentiate Backtracking and Branch and Bound. (Or) What is Difference between backtracking and branch and bound method?
Backtracking 1. 2. 3. 4. 5. It is used to find all possible solutions available to the problem. It traverse tree by DFS(Depth First Search). It realizes that it has made a bad choice & undoes the last choice by backing up. It searches the state space tree until it found a solution. It involves feasibility function.
Branch-and-Bound (BB) 1. It is used to solve optimization problem. 2. It may traverse the tree in any manner, DFS or BFS. 3. It realizes that it already has a better optimal solution that the pre-solution leads to so it abandons that pre-solution. 4. It completely searches the state space tree to get optimal solution. 5. It involves bounding function.
involves division by the variable x (4/x) and because its third term contains an exponent that is not a whole number (3/2). The term 'polynomial' indicates a simplified algebraic form such that all polynomials are similarly simple in complexity.
resulting cover is at most twice as large as the optimal one. This is a constant factor approximation algorithm with a factor of 2.
A Hamiltonian cycle may be used as the basis of a zero-knowledge proof. Number of different Hamiltonian cycles for a complete graph = (n-1)! / 2. Number of different Hamiltonian cycles for a complete directed graph = (n-1)!.
25. Brief Branch and Bound 26. Define greedy for continuous Knapsack problem 27. Define greedy for 0/1 Knapsack Problem 28. Define NP hard problem 29. Define NP complete 30. Define heuristic 31. Formula for approximation problem 32. Formula for travelling sales person 33. Write the adjacency matrix of the following graph 34. Define Strassens matrix 35. Write formula for Warshalls algorithm 36. Define greedy 37. Define optimal binary search 38. Define adjacency and path matrix 39. Define DP 40. Write Knapsack memory function algorithm 41. Define minimum spanning tree 42. What is numeric problem? 43. Divide conquer method of merge sort 44. Analyze one recursive problem 45. In order output and Post order output of this graph
46. Output of post-order of binary tree is GBQACKFPDERH draw the tree 47. Write the adjacency matrix of the following graph 48. Define path and cycle 49. What is combinatorial problem? 50. DC for merge sort 51. Analyze any one recursive problem 52. What are the characteristics of an algorithm? 53. Define the lower bound and upper bound of an algorithm. 54. Brief about the best case situation of an algorithm with an example. 55. Compare feasible solution and optimal solution. 56. Define the principle of optimality in Dynamic Programming. 57. Brief about recursive algorithm? 58. Explain the space complexity of an algorithm. 59. Brief about worst case situation of an algorithm with an example. 60. Brief about combinatorial problem 61. Write short notes about Greedy Method.
Section B
Explain optimal binary search with an example Explain Hamiltonian cycle with an example (7 Marks)
(7 Marks)
Let G = (V,E) be a connected graph with n vertices. Hamiltonian cycle is a round trip path along n edges of G that visits every vertex once and returns to its starting position. The graph may be directed or undirected, only distinct cycles are output. Algorithm Hamiltonian(k)
{ repeat { NextValue(k) If(x[k] = 0) then return If(k=n) then write(x[1:n]); Else Hamiltonian(k+1) }until(false) } Algorithm NextValue(k) { Repeat { x[k] = (x[k]+1) mod(n+1) if (x[k] = 0) then Return if (Gx[[k-1+, x*k++ 0) then { for j = 1 to k-1 do if(x[j]= x[k]) then break if(j=k) then if((k<n) or (( k=n) and G* x*n+, x*1++0)) then return } }until (false) }
3. Explain the Assignment problem of Branch and Bound with an example 4. Explain the travelling salesman problem in Branch and Bound. 5. Explain the sum of subset problem.
6. Write and explain Warshalls and Floyds algorithm. 7. Write and explain the N-queens algorithm 8. Explain about backtracking. 9. Explain about Branch and Bound 10. Explain about backtracking and compare it with branch and bound. 11. Explain branch and bound, and compare it with backtracking. 12. Explain memory function and memory bound function. 13.Apply Warshalls algorithm define by the following adjacency matrix
0 1 1 1 0 0 0 1 0 1 0 1 0 0 1 0
3 6 1 c
17.Write an algorithm and find the optimal solution to the Knapsack Problem instance n=7, m=15
(p1,p2, p7) = (10,5,15,7,6,18,3) (w1,w2,;;;w7)= (2,3,5,7,1,4,1)
18.Apply bottom up Dynamic programming algorithm to the following instance of knapsack problem
Capacity W = 6 Item 1 2 3 4 5 Weight 3 2 1 4 5 Value 25 20 15 40 50
19.Apply quick sort to the list. Write an algorithm in DC method 20.Write an algorithm for merge sort 21.Write an algorithm and in-order iteration for the following binary tree 22.Write Binary search algorithm using divide and conquer method 23.Explain in detail about Greedy Method with an example.
25.Explain PUSHING and POPING a value into queue with an example. 26.Explain post-order tree traversal.
27.Explain pre-order tree traversal with an example. 28.Describe post-order tree traversal with an example. 29.Explain quick sort algorithm with an example. 30.Explain quick sort algorithm for the sequence of values 44 33 11 55 77 40 50 79 12 98 66
31.Explain the algorithm for insertion sort to the following sequence of values 40,70,50,60,80.
33. Write and iterate the algorithm for max-min to the following sequence of values 34,37,44,49,58,75,25,20 34.Describe asymptotic notation and explain any two problem solving methods.