data structures

2
M.E/M.Tech DEGREE EXAMINATION, JANUARY 2010 First Semester Computer Science and Engineering CS9212 DATA STRUCTURES AND ALGORITHMS (Common to M.Tech- Information Technology) (Regulation 2009) Time: Three hours Maximum: 100 Marks Answer all the questions Part A (10*2=20 Marks) 1. Consider the two functions f (n) =3n^2+5 and g (n) =n^2. Prove with graphical representation that asymptotic upper bound of f (n) is g (n)? 2. Solve the recurrence equation of Merge sort to show that the worst-case complexity is O (nlogn)? 3. Define Null Path length? What is the role of NPL in Leftist Heap? 4. Is the height of every tree in a Binomial heap that has n elements O (log n)? If not what is the worst-case height as a function of n? 5. What is the maximum and minimum height of a binary tree with 28 nodes? Mention the suitable tree traversal to sort the values in increasing order? 6. Compare the worst case height of a red-black tree with n nodes and that of an AVL tree with the same number of nodes? 7. Why it is necessary to have the auxiliary array billow: high in function Merge? Give an example that shows why-in-place merging is insufficient? 8. Find an optimal placement for 13 programs on three tapes T0, T1 and T2. Where the programs are of lengths 12,5.8,3,2,7,5.1,8.2,4,3,11,10, and 6. 9. Give an example of a set of knapsack instances for which |s^i| = 2^I, 0<i<n. Your set should include one instance for each n. 10. Present a backtracking algorithm for solving the knapsack optimization problem using the variable tuple size formulation. Part B (5*16=80 Marks) 11. (a)(i)Discuss Strassen’s matrix multiplication as well as classical O (n^2) one. Determine when Strassen’s method outperforms the classical one. (8) (ii)Code the divide and conquer algorithm DCHull () in C++ and last it in appropriate data. (8) (Or)

Upload: s-m-keerthana-muniappan

Post on 03-Nov-2014

25 views

Category:

Documents


4 download

DESCRIPTION

PAGES RELATED TO DATA STRUCTURES

TRANSCRIPT

Page 1: DATA STRUCTURES

M.E/M.Tech DEGREE EXAMINATION, JANUARY 2010

First Semester

Computer Science and Engineering

CS9212 – DATA STRUCTURES AND ALGORITHMS

(Common to M.Tech- Information Technology)

(Regulation 2009)

Time: Three hours Maximum: 100 Marks

Answer all the questions

Part A – (10*2=20 Marks)

1. Consider the two functions f (n) =3n^2+5 and g (n) =n^2. Prove with graphical

representation that asymptotic upper bound of f (n) is g (n)?

2. Solve the recurrence equation of Merge sort to show that the worst-case complexity is

O (nlogn)?

3. Define Null Path length? What is the role of NPL in Leftist Heap?

4. Is the height of every tree in a Binomial heap that has n elements O (log n)? If not what is

the worst-case height as a function of n?

5. What is the maximum and minimum height of a binary tree with 28 nodes? Mention the

suitable tree traversal to sort the values in increasing order?

6. Compare the worst case height of a red-black tree with n nodes and that of an AVL tree

with the same number of nodes?

7. Why it is necessary to have the auxiliary array billow: high in function Merge? Give an

example that shows why-in-place merging is insufficient?

8. Find an optimal placement for 13 programs on three tapes T0, T1 and T2. Where the

programs are of lengths 12,5.8,3,2,7,5.1,8.2,4,3,11,10, and 6.

9. Give an example of a set of knapsack instances for which |s^i| = 2^I, 0<i<n. Your set

should include one instance for each n.

10. Present a backtracking algorithm for solving the knapsack optimization problem using

the variable tuple size formulation.

Part B – (5*16=80 Marks)

11. (a)(i)Discuss Strassen’s matrix multiplication as well as classical O (n^2) one. Determine

when Strassen’s method outperforms the classical one. (8)

(ii)Code the divide and conquer algorithm DCHull () in C++ and last it in appropriate

data. (8)

(Or)

Page 2: DATA STRUCTURES

(b)Code and distinguish the JS and FJS functions for job sequencing with suitable data.

Analyze the complexities of these two functions. (16)

12. (a)Find the minimum cost path from S to T in the multistage graph of the given figure.

Do this first using forward approach and then using backward approach. (16)

(Or)

(b)Give an n x n chess board, a knight is placed on an arbitrary square with coordinates

(x, y). The problem is to determine (n^2-1) knight moves such that every square of the

board is visited once if such a sequence of moves exists. Write a C++ program to solve

this problem. (16)