Beruflich Dokumente
Kultur Dokumente
Mergesort(B[0..(n/2)-1])
Mergesort(C[0..(n/2)-1])
Merge(B,C,A)
5. Give the algorithm to merge two sorted arrays into one.
ALGORITHM Merge(B[0..p-1], C[0..q-1], A[0..p+q-1])
Quicksort(A[l..s-1])
8. What is greedy technique?
Greedy technique suggests a greedy grab of the best alternative available in the
hope that a sequence of locally optimal choices will yield a globally optimal solution to
the entire problem. The choice must be made as follows
V,E
//Input A weighted connected graph G=
//Output ET, the set of edges composing a minimum spanning tree of G
VT {v0}
ET
for i 1 to |V|-1 do
Find the minimum-weight edge e *=(v*,u*) among all the edges (v,u)
such that v is in VT and u is in V-VT
VT VT
ET ET
{u*}
{e*}
return ET
10.
11.
How are the vertices not in the tree split into?
The vertices that are not in the tree are split into two sets
12.
13.
Q
QQ
Q
Q
14.
What is the method used to find the solution in n-queen
problem by symmetry?
The board of the n-queens problem has several symmetries so that
some solutions can be obtained by other reflections. Placements in the last
n/2 columns need not be considered, because any solution with the first
Merge sort
Quick sort
Binary search
DFS Algorithm
Example
BFS algorithm
Example
6. Explain about Transform-and-Conquer Approach
Explain
Presorting
Balanced Search Tree
Heaps and Heap sort
Dijkstras Algorithm