JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD MCA 2021 DATA STRUCTURES AND ALGORITHMS Previous Question Paper (July/August - 2021 - R17)

MCA | 2021 | II | R17 | July/August - 2021

Answer PaperPaper Code: 842AAMaximum Marks: 75Time: 3 Hours

Answer any five questions. All questions carry equal marks.

Main

115 marks
a

Rearrange following numbers using Quick sort: 10, 6, 3, 7, 17, 26, 56, 32, 72.

7 marks

Answer

To sort the array [10, 6, 3, 7, 17, 26, 56, 32, 72] using Quick Sort, we select the last element as the pivot.

  1. Initial array: [10, 6, 3, 7, 17, 26, 56, 32, 72]. Pivot = 72. All elements are smaller than 72, so 72 remains at the end.
  2. Sub-array [10, 6, 3, 7, 17, 26, 56, 32]. Pivot = 32. Elements smaller than 32 are [10, 6, 3, 7, 17, 26], elements larger are [56]. Array becomes [10, 6, 3, 7, 17, 26, 32, 56, 72].
  3. Sub-array [10, 6, 3, 7, 17, 26]. Pivot = 26. Elements smaller are [10, 6, 3, 7, 17]. Array becomes [10, 6, 3, 7, 17, 26, 32, 56, 72].
  4. Sub-array [10, 6, 3, 7, 17]. Pivot = 17. Elements smaller are [10, 6, 3, 7]. Array becomes [10, 6, 3, 7, 17, 26, 32, 56, 72].
  5. Sub-array [10, 6, 3, 7]. Pivot = 7. Elements smaller are [6, 3]. Array becomes [6, 3, 7, 10, 17, 26, 32, 56, 72].
  6. Sub-array [6, 3]. Pivot = 3. Swap results in [3, 6].
  7. Final sorted array: [3, 6, 7, 10, 17, 26, 32, 56, 72].
b

Give the properties asymptotic notations.

8 marks

Answer

Asymptotic notations are mathematical tools used to describe the limiting behavior of a function as its input grows towards infinity. The primary properties are:

  • Big-O Notation (O): Provides an asymptotic upper bound on the growth rate of a function. If f(n) = O(g(n)), then f(n) <= c*g(n) for all n >= n0.
  • Omega Notation (Ω): Provides an asymptotic lower bound. If f(n) = Ω(g(n)), then f(n) >= c*g(n) for all n >= n0.
  • Theta Notation (Θ): Provides an asymptotic tight bound, meaning the function is bounded both above and below by the same growth rate. f(n) = Θ(g(n)) if and only if f(n) = O(g(n)) and f(n) = Ω(g(n)).
  • Transitivity: If f(n) = O(g(n)) and g(n) = O(h(n)), then f(n) = O(h(n)). This applies to all three notations.
  • Reflexivity: Any function is asymptotically bounded by itself, e.g., f(n) = O(f(n)).
  • Symmetry: f(n) = Θ(g(n)) if and only if g(n) = Θ(f(n)).
2

Trace the Merge sort algorithm to sort the list A, V, I, S, H, K, R, U, T, H in alphabetical order.

15 marks

Answer

Sign in to view the complete answer paper.

3

What is the solution generated by function Job Sequencing algorithm when n = 6 (P1, P2, P3, P4, P5, P6) = (3, 5, 20, 18, 1, 6) and (D1, D2, D3, D4, D5, D6) = (1, 3, 4, 3, 2, 1).

15 marks

Answer

Sign in to view the complete answer paper.

4

What is a Spanning tree? Explain Prim’s and Krushkal’s algorithm with the following graph.

15 marks

Answer

Sign in to view the complete answer paper.

5

Draw an Optimal Binary Search Tree for n = 4 identifiers (a1, a2, a3, a4) = (do, if, read, while) P(1:4) = (3, 3, 1, 1) and Q(0:4) = (2, 3, 1, 1, 1).

15 marks

Answer

Sign in to view the complete answer paper.

6

Discuss the 4 – Queen’s problem. Draw the portion of the state space tree for n = 4 Queens using backtracking algorithm.

15 marks

Answer

Sign in to view the complete answer paper.

7

Define Max Heap. Construct Max Heap for the following: 140, 80, 30, 20, 10, 40, 30, 60, 100, 70, 160, 50, 130, 110, 120.

15 marks

Answer

Sign in to view the complete answer paper.

815 marks
a

Show that the maximum number of nodes in a Binary tree of height ‘h’ is 2h+1 - 1.

7 marks

Answer

Sign in to view the complete answer paper.

b

Explain in detail about creation of a Binary Search Tree with suitable example.

8 marks

Answer

Sign in to view the complete answer paper.

About this paper

This page contains the question paper of DATA STRUCTURES AND ALGORITHMS from JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD for MCA 2021 II, July/August - 2021, R17.

For the solved question paper with answers, switch to the Answer Paper tab.

Other papers in DATA STRUCTURES AND ALGORITHMS

Loading Question Papers

Fetching data from database...