Design and Analysis of Algorithms 2068

Tribhuwan University
Institute of Science and Technology
2068
Bachelor Level / Fifth Semester / Science
Computer Science and Information Technology ( CSC-303 )
( Design and Analysis of Algorithms )
Full Marks: 80
Pass Marks: 32
Time: 3 hours
Candidates are required to give their answers in their own words as far as practicable.
The figures in the margin indicate full marks.

Attempt all questions.

1.  Write down the formal definition of big-oh, big-omega and big-theta notation with examples.

8 marks view

2.  What is recurrence relation? Find big-O of following recurrence using recurrence tree method.                                                                                                                                 

8 marks view

3.  Make a tight big-O analysis of following code.

void main()

{

   int m, n, i, j, a[], b[], c[];

   printf(“Enter value of m and n”);

   scanf(“%d%d”,&m,&n);

   for(i=1;i<=m;i++)

      a[i]=i*i;

   for(j=1;j<=n;j++)

      b[j]=-j;

   for(i=1;i<=m;i++)

      printf(“%d”, a[i]);

   for(j=1;j<=n;j++)

      printf(“%d”, b[j]);

}         
8 marks view

4.  What is linear data structure? Write down the algorithm of heap sort and find its complexity analysis.

8 marks view

5.  What is divide and conquer technique? Using this technique. Write an algorithm of quick sort then analyze it.                                                                                                        

8 marks view

6.  What are the advantages of dynamic programming? Find Longest Common Subsequence (LCS) between “abbaab” and “aabaabb”.                                                                     

8 marks view

7.  What is shortest path problem? Explain Dijkstra’s algorithm for shortest path problem. 

8 marks view

8.  What is left turn and right turn? Give an algorithm for finding two lines segments intersect or not by using left turn and right turn. Does this algorithm works for all cases? Justify with example.

8 marks view

9.  Define the terms “Class P”, “Class NP” and “NP-completeness”.                                  

8 marks view

10.  What is the concept of randomized algorithm? Write an algorithm of approx..-vertex-cover problem and analyze it.

8 marks view