Design and Analysis of Algorithms - B.Tech 5th Semester Special Exam., 2020
Design and Analysis of Algorithms
Instructions:
- The marks are indicated in the right-hand margin.
- There are EIGHT questions in this paper.
- Attempt FIVE questions in all.
- Question No. 1 is compulsory.
-
Find the complexity of the below program:
void function(int n) { int i=1, s=1; while(s<=n) { i++; s+=i; printf("*"); } } -
How many undirected graphs (not necessarily connected) can be constructed out of a given set \( V = \{V_1, V_2, \dots, V_n\} \) of n vertices?
-
The recurrence relation capturing the optimal time of the Tower of Hanoi problem with n discs is
-
Dijkstra's algorithm is based on
-
Randomized quicksort is an extension of quicksort where the pivot is chosen randomly. What is the worst case complexity of sorting n numbers using randomized quicksort?
-
Name three sorting algorithms which are stable by nature.
-
What is the worst time complexity of insertion sort?
-
The most efficient algorithm for finding the number of connected components in an undirected graph of n vertices and m edges has the time complexity
-
Which of the following statement is not true about breadth-first search (BFS) in an undirected graph starting at a vertex v?
-
Finding the location of the element with a given value is
-
Write the asymptomatic notation used for best case, average case and worst case analysis of algorithm. Write an algorithm for finding maximum element in an array. Give best, worst and average case complexities.
-
Explain the brute force method to find the two closet points in a set of n points in k-dimensional space.
-
Explain the working of merge sort algorithm with an example. Give the complexity calculation of merge sort.
-
Write an algorithm based on divide-and-conquer strategy to search an element in a given list. Assume that the elements of list are in sorted order.
-
What is the relationship among P, NP and NP-complete problems? Show with the help of a diagram.
-
Give the complete solution (step-by-step using state space tree) for N-Queen problem using back-tracking with pseudocode. Give the complexity analysis.
-
Construct the Huffman coding tree for the text of characters with given frequencies: T:43, I:38, V:16, K:8, L:56, E:12, O:41, Z:13, P:22, R:6. Also find the variable length Huffman codes and frequency path length for corresponding above characters.
-
Find the optimal way to multiply the following matrices to perform the fewest multiplications:
\( A_1: 5 \times 11 \), \( A_2: 11 \times 4 \), \( A_3: 4 \times 15 \), \( A_4: 15 \times 23 \)