JNTU

JNTU B.Tech IV ADVANCED ALGORITHMS Previous Question Paper (September - 2022 - R16)

B.Tech | IV | II | R16 | September - 2022

Answer PaperPaper Code: 138ACMaximum Marks: 75Time: 3 Hours

Answer any five questions. All questions carry equal marks.

Main

115 marks
a

What is optimal binary search tree? Give dynamic programming formulation for the same.

7 marks

Answer

An Optimal Binary Search Tree (OBST) is a binary search tree constructed for a given set of keys with associated access probabilities such that the total search cost is minimized. If keys are sorted, the tree structure that minimizes the expected number of comparisons is chosen.

The dynamic programming formulation defines e[i, j] as the minimum expected cost of a search in an OBST containing keys ki through kj. Let w[i, j] be the sum of probabilities of keys ki to kj. The recurrence is:

e[i, j] = mini≤r≤j { e[i, r-1] + e[r+1, j] + w[i, j] }

Base cases are e[i, i-1] = di-1, representing the cost of dummy keys when the tree is empty.

b

How Partition is done in Quick Sort? Explain with an example.

8 marks

Answer

The Partition process in Quick Sort rearranges a subarray A[p...r] around a pivot element x = A[r]. It places the pivot in its correct sorted position such that all elements to the left are less than or equal to the pivot, and all elements to the right are greater than the pivot.

  1. Initialize i = p - 1.
  2. Iterate j from p to r-1.
  3. If A[j] ≤ x, increment i and swap A[i] with A[j].
  4. Finally, swap A[i+1] with the pivot A[r].

Example: Consider [2, 8, 7, 1, 3, 5, 6, 4]. With pivot 4: 2 is smaller (swap), 8 is larger, 7 is larger, 1 is smaller (swap), 3 is smaller (swap). The array becomes [2, 1, 3, 4, 8, 5, 6, 7], where 4 is now at index 3.

215 marks
a

Discuss in detail about randomized algorithms.

7 marks

Answer

Sign in to view the complete answer paper.

b

Write an algorithm/pseudocode to sort elements using Heap sort technique. Illustrate the working of Heap sort algorithm on the following input: 35, 15, 0, 1, 60.

8 marks

Answer

Sign in to view the complete answer paper.

315 marks
a

How Dynamic Programming is used to solve Knapsack Problem? Explain.

7 marks

Answer

Sign in to view the complete answer paper.

b

Define the Single Source Shortest Path Problem and explain any one algorithm.

8 marks

Answer

Sign in to view the complete answer paper.

415 marks
a

Write Huffman code algorithm and derive its complexity.

7 marks

Answer

Sign in to view the complete answer paper.

b

Illustrate about minimum spanning trees with suitable examples.

8 marks

Answer

Sign in to view the complete answer paper.

515 marks
a

What is Strassen’s matrix multiplication? Explain with example. Why is Strassen matrix multiplication considered better than simple matrix multiplication? Discuss.

7 marks

Answer

Sign in to view the complete answer paper.

b

Discuss in detail about Zero-one principle with example.

8 marks

Answer

Sign in to view the complete answer paper.

615 marks
a

Compute inverse of A = [[1, 1, 0, 0], [1, 2, 1, 0], [0, 1, 2, 1], [0, 0, 1, 2]].

7 marks

Answer

Sign in to view the complete answer paper.

b

Write a detailed note on sorting networks.

8 marks

Answer

Sign in to view the complete answer paper.

715 marks
a

What is naive string matching algorithm? Write the complexity of naïve string matching.

7 marks

Answer

Sign in to view the complete answer paper.

b

Discuss the purpose of Knuth Morris Pratt algorithm? What problem does it solve? Explain.

8 marks

Answer

Sign in to view the complete answer paper.

815 marks
a

Explain Traveling Salesman problem with suitable example.

7 marks

Answer

Sign in to view the complete answer paper.

b

List and discuss various approximation algorithms in brief.

8 marks

Answer

Sign in to view the complete answer paper.

About this paper

This page contains the solved question paper with answers of ADVANCED ALGORITHMS from JNTU for B.Tech CSE IV II, September - 2022, R16.

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

Other papers in ADVANCED ALGORITHMS

Loading Question Papers

Fetching data from database...