JNTU

JNTU B.Tech III DESIGN AND ANALYSIS OF ALGORITHMS Previous Question Paper (August/September - 2021 - R18)

B.Tech | III | II | R18 | August/September - 2021

Answer PaperPaper Code: 156ANMaximum Marks: 75Time: 3 Hours

Answer any five questions. All questions carry equal marks.

Main

115 marks
a

Write and explain randomized quick sort algorithm.

8 marks

Answer

Randomized Quick Sort is a variation of the standard Quick Sort algorithm where the pivot element is chosen randomly from the array instead of always picking the first or last element. This randomization ensures that the algorithm achieves an average-case time complexity of O(n log n) regardless of the input distribution, effectively preventing the worst-case O(n²) performance on already sorted or nearly sorted arrays.

The algorithm follows these steps:

  • Select a random index between the current low and high bounds.
  • Swap the element at the random index with the element at the high index to treat it as the pivot.
  • Perform the standard partition procedure to place the pivot in its correct sorted position, such that all elements to the left are smaller and all elements to the right are larger.
  • Recursively apply the same process to the left and right sub-arrays.

By picking a random pivot, the probability of consistently hitting the worst-case partition is extremely low, making the algorithm robust for practical applications.

b

Discuss about Big oh O, Omega Ω and Theta θ notations with examples.

7 marks

Answer

Asymptotic notations are used to describe the growth rate of algorithms as the input size n approaches infinity.

Big-O Notation (O): Provides an asymptotic upper bound. A function f(n) is O(g(n)) if there exist positive constants c and n₀ such that 0 ≤ f(n) ≤ c·g(n) for all n ≥ n₀. It represents the worst-case complexity. Example: 3n + 2 is O(n).

Omega Notation (Ω): Provides an asymptotic lower bound. A function f(n) is Ω(g(n)) if there exist positive constants c and n₀ such that 0 ≤ c·g(n) ≤ f(n) for all n ≥ n₀. It represents the best-case complexity. Example: 3n + 2 is Ω(n).

Theta Notation (θ): Provides an asymptotic tight bound. A function f(n) is θ(g(n)) if there exist positive constants c₁, c₂, and n₀ such that c₁·g(n) ≤ f(n) ≤ c₂·g(n) for all n ≥ n₀. It occurs when the algorithm's upper and lower bounds are the same. Example: 3n + 2 is θ(n).

215 marks
a

Using Merge sort, sort the following elements: 310, 285, 179, 652, 351, 423, 861, 254, 450, 520

7 marks

Answer

Sign in to view the complete answer paper.

b

Analyze the computing time complexity of binary search algorithm.

8 marks

Answer

Sign in to view the complete answer paper.

315 marks
a

Show that depth first search can be used to find the connected components of an undirected graph.

8 marks

Answer

Sign in to view the complete answer paper.

b

Write an algorithm of n-queen’s problem and explain.

7 marks

Answer

Sign in to view the complete answer paper.

4

Suppose we start with n sets, each containing a distinct element.

15 marks
a

Show that if u unions are performed, then no set contains more than u+1 elements.

5 marks

Answer

Sign in to view the complete answer paper.

b

Show that at most n – 1 unions can be performed before the number of sets becomes 1.

5 marks

Answer

Sign in to view the complete answer paper.

c

Show that if fewer than (n/2) unions are performed, then at least one set with a single element in it remains.

5 marks

Answer

Sign in to view the complete answer paper.

515 marks
a

Solve the following 0/1 Knapsack Problem using dynamic programming: n=4, m=30, (w1,w2,w3,w4) = (10,15,6,9) and (p1, p2, p3, p4) = (2,5,8,1).

7 marks

Answer

Sign in to view the complete answer paper.

b

Explain the concept of the traveling salesperson problem.

8 marks

Answer

Sign in to view the complete answer paper.

6

Use the function OBST to compute w(i,j), r(i,j), and c(i,j), 0 ≤ i < j ≤ 4, for the identifier set (a1, a2, a3, a4) = (do, if, int, while) with p(1 : 4) = (3, 3, 1, 1) and q(0:4)=(2,3,1,1,1). Using the r(i,j)’s construct the optimal binary search tree.

15 marks

Answer

Sign in to view the complete answer paper.

715 marks
a

Explain the general method of Greedy method.

7 marks

Answer

Sign in to view the complete answer paper.

b

Write and explain the Kruskal’s algorithm with an illustrative example.

8 marks

Answer

Sign in to view the complete answer paper.

815 marks
a

Explain with respect to branch and bound 0/1 knapsack problem.

7 marks

Answer

Sign in to view the complete answer paper.

b

Discuss in detail about the classes of NP-hard and NP-complete.

8 marks

Answer

Sign in to view the complete answer paper.

About this paper

This page contains the solved question paper with answers of DESIGN AND ANALYSIS OF ALGORITHMS from JNTU for B.Tech CSE III II, August/September - 2021, R18.

For the question paper without answers, switch to the Question Paper tab.

Other papers in DESIGN AND ANALYSIS OF ALGORITHMS

Loading Question Papers

Fetching data from database...