Design and Analysis of Algorithms - B.Tech 5th Semester Exam., 2018
Design and Analysis of Algorithms
Instructions:
- All questions carry equal marks.
- There are NINE questions in this paper.
- Attempt any FIVE questions in all.
- Question No. 1 is compulsory.
-
Which algorithm is better for sorting between bubble sort and quicksort?
-
An algorithm which uses the past results and uses them to find the new results is
-
Out of the following which property of algorithm does not share?
-
Which of the following standard algorithms is not a greedy algorithm?
-
What is the time complexity of Huffman coding?
-
How many comparisons are required to sort the list 1, 2, 3... n using insertion sort?
-
Which of the following is true about Huffman coding?
-
A complexity of algorithm depends upon
-
A text is made up of the characters a, b, c, d, e each occurring with the probability 0.11, 0.40, 0.16, 0.09 and 0.24 respectively. The optimal Huffman coding technique will have the average length of
-
Build heap is used in heap sort as a first step for sorting. What is the time complexity of build heap operation?
-
Solve the following recurrence by successive substitution method:
\( f(1) = 1 \), if \( n=1 \)
\( f(n) = 3f(n/2) + 6 \), if \( n>1 \)
-
COUNTING SORT algorithm assumes that each of the n input elements is an integer in the range 0 to k, for some integer k. When \( k=O(n) \), the sort runs in \( \Theta(n) \) time. Change COUNTING SORT algorithm for the numbers lying in the range p to q where \( (q-p) \) is still \( O(n) \). Also analyze the new complexity.
-
Consider a directed acyclic graph with non-negative edge costs and with a given start vertex s. Write an algorithm to compute distances from source s in \( O(E+V) \) time. Justify why your algorithm is correct.
-
Explain, with an example, why Dijkstra's algorithm might take \( \Omega(V \log V) \) time.
-
Consider the two standard representations of directed graphs: the adjacency-list representation and the adjacency-matrix representation. Find a problem that can be solved more efficiently in the adjacency-list representation than in the adjacency-matrix representation, and another problem that can be solved more efficiently in the adjacency-matrix representation than in the adjacency-list representation.
-
Differentiate between the following: Fractional Knapsack vs. 0/1 Knapsack.
-
Differentiate between the following: Kruskal's vs. Prim's Algorithm.
-
What are NP-complete problems? Write some problems which are P, NP and NP-hard. Explain any NP-hard problem in detail.
-
Explain quicksort and its asymptotic complexities. Take some distinct numbers and perform quicksort over it.
-
Explain travelling salesman problem using Greedy method.
-
Explain travelling salesman problem using Dynamic programming method.