05211201 Advanced Data Structures  And  Algorithms
Upcoming SlideShare
Loading in...5
×
 

05211201 Advanced Data Structures And Algorithms

on

  • 3,526 views

05211201 Advanced Data Structures And Algorithms

05211201 Advanced Data Structures And Algorithms

Statistics

Views

Total Views
3,526
Views on SlideShare
3,526
Embed Views
0

Actions

Likes
0
Downloads
70
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

05211201 Advanced Data Structures  And  Algorithms 05211201 Advanced Data Structures And Algorithms Document Transcript

  • www.studentyogi.com www.studentyogi.com Code No: R05211201 Set No. 1 II B.Tech I Semester Supplimentary Examinations, November 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 are the two steps that happen with delete p? (b) What are the advantages of new operator than mallo c in C? (c) Explain about the C++ classes in detail and design a class for playing cards? [5+5+6] 2. (a) When should my destructor be virtual? (b) What is a “virtual constructor”? (c) What’s the di erence between how virtual and non-virtual member functions are called? [5+5+6] 3. (a) What are some ways try / catch / throw can improve software quality? (b) How can we handle a constructor that fails? (c) How can we handle a destructor that fails. [5+5+6] 4. (a) What are the applications of stack explain with an example. (b) Explain the list representation of a tree by means of an example. (c) Mention some common computing times for algorithms in order of increasing di culty? [5+5+6] 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 con gured hash table in which neverUsed is true for every empty bucket. [16] 6. What is an AVL Tree? Write the algorithm to search for an element of an AVL Search Tree? What is its time complexity? [16] 7. (a) Write a non recursive algorithm for post order traversal of a tree and also analyze its time complexity. (b) Explain the properties of depth rst search? [10+6] 8. (a) Show how Prim’s algorithm can be implemented using heap. What would be the time complexity of the algorithm. 1 of 2 www.studentyogi.com www.studentyogi.com
  • www.studentyogi.com www.studentyogi.com Code No: R05211201 Set No. 1 (b) What is the time complexity of traveling sales person problem using dynamic programming. [10+6] 2 of 2 www.studentyogi.com www.studentyogi.com
  • www.studentyogi.com www.studentyogi.com Code No: R05211201 Set No. 2 II B.Tech I Semester Supplimentary Examinations, November 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) When are temporary variables created by C++ compiler? (b) What is a local class? Why can it be useful? (c) Can a copy constructor accept an object of the same class as parameter, instead of reference of the object? (d) What is a class? [4+4+4+4] 2. (a) Explain the need for “Virtual Destructor”. (b) Can we have “Virtual Constructors”? [8+8] 3. (a) How can we provide printing for an entire hierarchy of classes? (b) How can we open a stream in binary mode? (c) How can we “reopen” std::cin and std::cout in binary mode? [5+5+6] 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) Explain about the skip list representation of dictionary with an example? (b) What are the data members of class? Write the constructor for . [8+8] 6. (a) What is a Red-Black tree? Explain about the representation of a Red-Black tree? (b) Write the algorithm to search for an element of a Red-Black Tree? What is its time complexity? [8+8] 7. (a) Find a necessary and su cient condition for the root of a depth rst 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 (vn) +logn where n 4 8. (a) What is dynamic programming technique? How does it di er from divide and conquer technique. (b) Solve the Greedy Knapsack problem where m=25, n=3, P = (25,24,17) and W = (16,14,9). [8+8] 1 of 1 www.studentyogi.com www.studentyogi.com
  • www.studentyogi.com www.studentyogi.com Code No: R05211201 Set No. 3 II B.Tech I Semester Supplimentary Examinations, November 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) Can you think of a situation where your program would crash without reaching the breakpoint which you set at the beginning of main()? (b) When are copy constructors called? (c) Can a copy constructor accept an object of the same class as parameter, instead of reference of the object? [5+5+6] 2. (a) What is Hybrid inheritance? Write a program to illustrate the concept of Hybrid Inheritance. (b) What is single inheritance? Write a program to illustrate the concept of single Inheritance. [8+8] 3. (a) How should we handle resources if constructors may throw exceptions? (b) How do we change the string-length of an array of char to prevent memory leaks even if/when someone throws an exception? (c) What should we throw? What should we catch? [5+5+6] 4. (a) Solve the recurrence relation , where N is an integer power of 3 ( ) = 6 ( 3) + 2 - 1 1 =2 =1 (b) Write an algorithm of deletion of an element from a heap also analyze its time complexity. [8+8] 5. (a) What is a dictionary? De ne the abstract data type for it? Write the abstract class for the dictionary? (b) Give the applications of dictionary or dictionary with duplicates in which sequential access is desired. [8+8] 6. Start with a Splay tree that is a 15 no de full binary tree ; the keys are 1 to 15. search for the keys in the order: 15, 14, 13, 12...1 Draw the tree immediately after each rotation that is performed and Label the rotation types. [16] 7. Write and explain a non recursive algorithm for post order traversal of a Binary tree with an example. [16] 8. (a) Explain the OBST algorithm. 1 of 2 www.studentyogi.com www.studentyogi.com
  • www.studentyogi.com www.studentyogi.com Code No: R05211201 Set No. 3 (b) Solve the Knapsack Problem by considering the instance n=3, m=6, ( 1 2 3) = ( 2,3,4) and ( 1 2 3) = (1,2,5). [8+8] 2 of 2 www.studentyogi.com www.studentyogi.com
  • www.studentyogi.com www.studentyogi.com Code No: R05211201 Set No. 4 II B.Tech I Semester Supplimentary Examinations, November 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) Compare use of macros, inline-functions and template-functions. (b) How can you competently organize nontrivial sorting using tools of standard C and C++ libraries (compare the approaches)? (c) Tell what and how you can do to be able to put class objects into cout and read them from cin? [5+5+6] 2. (a) What’s the di erence between public, private, and protected? (b) Why can’t the derived class access private things from my base class? (c) How can we protect derived classes from breaking when we change the internal parts of the base class? [5+5+6] 3. What is an Error and Exception? Explain the exception handling mechanism in C++ ? [16] 4. (a) What is heap? Write an algorithm for implementing priority Queue using heap. (b) If f(n) + amnm+ a1n + a0 and am 0 then prove that f(n) = (nm). [8+8] 5. What is Hashing? Explain the di erent Hash table representations in detail? [16] 6. (a) What is an AVL search tree? How do we de ne the height of it? Explain about the associated with a no de of an AVL tree. (b) Explain how an AVL tree can be used to sort a sequence of n elements in O (n log n) time. [8+8] 7. Write and explain a non recursive algorithm for post order traversal of a Binary tree with an example. [16] 8. (a) What is Spanning tree? Explain the Prim’s algorithm with an example. (b) Find the shortest path between all pairs of nodes as shown in the gure.8bby using TSP. [8+8] 1 of 2 www.studentyogi.com www.studentyogi.com
  • www.studentyogi.com www.studentyogi.com Code No: R05211201 Set No. 4 Figure 8b 2 of 2 www.studentyogi.com www.studentyogi.com