Sie sind auf Seite 1von 5

Code No: R059211201 Set No.

1
II B.Tech I Semester Supplimentary Examinations, February 2008
ADVANCED DATA STRUCTURES AND ALGORITHMS
( Common to Information Technology and Computer Science & Systems
Engineering)
Time: 3 hours Max Marks: 80
Answer any FIVE Questions
All Questions carry equal marks
⋆⋆⋆⋆⋆

1. (a) What is a friend function? Explain the advantages and disadvantages of it?
(b) What is static member function? Explain it’s limitations. [8+8]

2. (a) Explain the concept of virtual functions in C++ with suitable examples.
(b) Explain the concept of operator overloading in C++. [8+8]

3. (a) Write a program to replace all the occurrences of a word with some other word
in a given file.
(b) Write a program to check whether the given string is palindrome or not. [8+8]

4. Write an algorithm for transposing a given matrix of n × m size and determine the
time complexity of the algorithm by using Asymptotic notation method. [16]

5. (a) What is the structure to represent node in a skip list. Write the constructor
for skipList.
(b) Write a method in C++ to find a pair with key theKey in a dictionary using
skip list representation? What is its complexity? [8+8]

6. What is an AVL Tree? Explain about the different rotation patterns in AVL trees
for balancing with appropriate examples? [16]

7. (a) Find a necessary and sufficient condition for the root of a depth first search
for a connected graph to be an articulation point.
(b) Solve the following recurrence relation using substitution method [8+8]
T(n) = 1 √ where n <= 4
= 2T ( n) +logn where n > 4

8. (a) If objects are selected in order of decreasing Vi /Wi then prove that the algo-
rithm Knapsack finds an optimal solution.
(b) Explain the Optimal binary search tree. [8+8]

⋆⋆⋆⋆⋆

1 of 1
Code No: R059211201 Set No. 2
II B.Tech I Semester Supplimentary Examinations, February 2008
ADVANCED DATA STRUCTURES AND ALGORITHMS
( Common to Information Technology and Computer Science & Systems
Engineering)
Time: 3 hours Max Marks: 80
Answer any FIVE Questions
All Questions carry equal marks
⋆⋆⋆⋆⋆

1. (a) What do you mean by Data abstraction?


(b) Difference between “C structure” and “C++ structure”.
(c) Diffrence between a “assignment operator” and a “copy constructor”.
(d) What is the difference between ?overloading? and “overridding”? [4+4+4+4]
2. (a) Explain the need for “Virtual Destructor”.
(b) Can we have “Virtual Constructors”? [8+8]
3. (a) What does throw; (without an exception object after the throw keyword)
mean? Where would we use it?
(b) How do we throw polymorphically?
(c) When we throw this object, how many times will it be copied? [5+5+6]
4. (a) Discuss briefly the asymptotic notations used for finding the complexity of
Algorithms.
(b) Write a C++ program to implement the sparse matrix. [8+8]
5. Define the abstract class for dictionary? Write the methods f ind, insert, erase used
in dictionary? Explain the time complexities to perform above three operations?
[16]
6. (a) Prove that the insertion of a new node in a red-black tree with n nodes in θ
(logn) time in the worst case.
(b) Derive the amortized complexity of a find, insert or delete operation performed
on a splay tree with n elements. [8+8]
7. (a) Find a necessary and sufficient condition for the root of a depth first search
for a connected graph to be an articulation point.
(b) Solve the following recurrence relation using substitution method [8+8]
T(n) = 1 √ where n <= 4
= 2T ( n) +logn where n > 4
8. (a) Show how Prim’s algorithm can be implemented using heap. What would be
the time complexity of the algorithm.
(b) What is the time complexity of traveling sales person problem using dynamic
programming. [10+6]

⋆⋆⋆⋆⋆

1 of 1
Code No: R059211201 Set No. 3
II B.Tech I Semester Supplimentary Examinations, February 2008
ADVANCED DATA STRUCTURES AND ALGORITHMS
( Common to Information Technology and Computer Science & Systems
Engineering)
Time: 3 hours Max Marks: 80
Answer any FIVE Questions
All Questions carry equal marks
⋆⋆⋆⋆⋆

1. (a) Explain about the dynamic memory allocation and de-allocation in C++.
(b) Explain about static inner classes with a program. [8+8]

2. Explain the difference between virtual function and virtual inheritance. [16]

3. (a) Why should we use iostream instead of the traditional cstdio?


(b) Why does a program go into an infinite loop when someone enters an invalid
input character?
(c) How can we get std::cin to skip invalid input characters? [5+6+5]

4. (a) What is meat by Profiling ? Explain it with an example.


(b) Trace the heap sort algorithm to sort the following list of numbers
8, 20, 9, 4, 15, 10, 7, 22, 3, 12. [8+8]

5. Develop a class for hash table using linear probing and neverUsed concept to handle
an erase operation. Write complete C++ code for all the methods. Include a
method to reorganize the table when (say) 60% of the empty buckets have never
used equal to false. The reorganization should move pairs around as necessary and
leave a properly configured hash table in which neverUsed is true for every empty
bucket. [16]

6. Define a Binary Search Tree? Write the procedures to perform insertion, deletion
and searching in a binary search tree? [16]

7. (a) Show that depth first search can be used to find the connected components of
an undirected graph.
(b) Write the Quick sort algorithm Also analyze its time complexity in Best case.
[6+10]

8. (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).
(b) Differentiate between Greedy method and Dynamic Programming [8+8]

⋆⋆⋆⋆⋆

1 of 1
Code No: R059211201 Set No. 4
II B.Tech I Semester Supplimentary Examinations, February 2008
ADVANCED DATA STRUCTURES AND ALGORITHMS
( Common to Information Technology and Computer Science & Systems
Engineering)
Time: 3 hours Max Marks: 80
Answer any FIVE Questions
All Questions carry equal marks
⋆⋆⋆⋆⋆

1. (a) Explain about the static variable?


(b) Explain about the static functions and static classes in detail with a program.
[8+8]

2. (a) What special considerations do we need to know about when I use Virtual
Inheritance?
(b) What special considerations do we need to know about when I inherit from a
class that uses virtual inheritance?
(c) What special considerations do I need to know about when I use a class that
uses virtual inheritance? [5+5+6]

3. (a) What does throw; (without an exception object after the throw keyword)
mean? Where would we use it?
(b) How do we throw polymorphically?
(c) When we throw this object, how many times will it be copied? [5+5+6]

4. (a) What is a heap ? Differentiate between heap and binary search tree.
(b) Show that log 3 n is O(n1/3 ).
(c) Briefly explain about Hashing. [5+5+6]

5. (a) Explain the linear probing method in Hashing? Explain its performance analy-
sis?
(b) What is hashing with Chains? Explain? Compare this with Linear Probing?
[8+8]

6. (a) Prove that the insertion of a new node in a red-black tree with n nodes in θ
(logn) time in the worst case.
(b) Derive the amortized complexity of a find, insert or delete operation performed
on a splay tree with n elements. [8+8]

7. Prove the equation T( N ) + a T ( N /b ) + θ(N k log p N ) [16]


Where a≥1, b≥1 and P≥0 is
T(N) = O(Nlogb a)ifa > b
k

O (Nk logp+1 N) if a = bk
O(Nk logp N) if a < bk .

1 of 2
Code No: R059211201 Set No. 4
8. (a) Show how Prim’s algorithm can be implemented using heap. What would be
the time complexity of the algorithm.
(b) What is the time complexity of traveling sales person problem using dynamic
programming. [10+6]

⋆⋆⋆⋆⋆

2 of 2

Das könnte Ihnen auch gefallen