Design and Analysis of Algorithms 2069

Question Paper Details
Tribhuwan University
Institute of Science and Technology
2069
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.

Official Answer
AI Generated Answer

AI is thinking...

1.  Use RAM model to estimate the big-oh of the running time for following code segment.

for(i=0;i<n;i++){

                             small pos = i;

                                    smallest = Array[small pos];

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

                                    if(Array[j]<smallest){

                                                small pos = j;

                                                smallest=Array[small pos];

                                    }

            }

            Array[small pos]=Array[i];

            Array[i] = smallest;

        }          

8 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

2.  What do you mean by recurrence relation? Estimate the running time of algorithm given by following recurrence relations using master method.

                           

8 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

3.  Explain the quick sort algorithm with its complexity analysis. How randomized quick sort works efficiently even for worst case.

8 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

4.  Define order statistics. Write an algorithm that is able to select ith largest element from an un-ordered list in linear time and analyzer for its complexity.

8 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

5.  Sketch the Prim’s algorithm for computing MST of a graph and analyze its complexity. Also trace the algorithm for the following graph.

                                           

8 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

6.  Give the job sequencing algorithm with deadlines. You have given 5 jobs with profit pi and deadline di as

job i = { 1, 2, 3, 4, 5}

pi = {20, 10, 5, 15, 1}

di = { 2, 1, 3, 2, 3}

      Find the optimal job lists that can be executed in sequence with in their deadlines so as to maximize the profits.
8 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

7.  Explain and analyze the Floyd’s warshall algorithm for all pair shortest path problem. Trace the algorithm for the following graph.

                          

8 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

8.  What do you mean by left turn and right turn for given three points in 2D? Explain the method for computing the intersection of two line segment efficiently.

8 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

9.  Explain about Class P, Class NP and NP-complete with suitable examples.

8 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

10. Explain the Gram’s scan algorithm with example to compute the convex hull of the set of points in 2D.       

8 marks
Details
Official Answer
AI Generated Answer

AI is thinking...