SlideShare a Scribd company logo
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

More Related Content

PDF
PDF
D E S I G N A N D A N A L Y S I S O F A L G O R I T H M S J N T U M O D E L...
PDF
Daa q.paper
PDF
PDF
Predicting organic reaction outcomes with weisfeiler lehman network
PPTX
Tensorflow in practice by Engineer - donghwi cha
PDF
NIPS2017 Few-shot Learning and Graph Convolution
PDF
Variadic CRTP : NOTES
D E S I G N A N D A N A L Y S I S O F A L G O R I T H M S J N T U M O D E L...
Daa q.paper
Predicting organic reaction outcomes with weisfeiler lehman network
Tensorflow in practice by Engineer - donghwi cha
NIPS2017 Few-shot Learning and Graph Convolution
Variadic CRTP : NOTES

What's hot (19)

PDF
Differential analyses of structures in HiC data
PPTX
Deep Learning: R with Keras and TensorFlow
PPTX
Deep Learning, Scala, and Spark
PDF
MUMS Opening Workshop - Machine-Learning Error Models for Quantifying the Epi...
PPTX
C++ and Deep Learning
PDF
Three CRuby Performance Projects
PDF
Gate Previous Years Papers
PPTX
Scala and Deep Learning
PDF
Speaker Diarization
PDF
20110319 parameterized algorithms_fomin_lecture01-02
PDF
Deep learning for molecules, introduction to chainer chemistry
PPTX
Deep Learning, Keras, and TensorFlow
PDF
EuroPython 2017 - PyData - Deep Learning your Broadband Network @ HOME
PDF
Europy17_dibernardo
PDF
Multimodal Residual Learning for Visual Question-Answering
PDF
Review_Cibe Sridharan
PDF
SchNet: A continuous-filter convolutional neural network for modeling quantum...
PDF
Mining Frequent Closed Graphs on Evolving Data Streams
PDF
Hate Speech in Pixels: Detection of Offensive Memes towards Automatic Moderation
Differential analyses of structures in HiC data
Deep Learning: R with Keras and TensorFlow
Deep Learning, Scala, and Spark
MUMS Opening Workshop - Machine-Learning Error Models for Quantifying the Epi...
C++ and Deep Learning
Three CRuby Performance Projects
Gate Previous Years Papers
Scala and Deep Learning
Speaker Diarization
20110319 parameterized algorithms_fomin_lecture01-02
Deep learning for molecules, introduction to chainer chemistry
Deep Learning, Keras, and TensorFlow
EuroPython 2017 - PyData - Deep Learning your Broadband Network @ HOME
Europy17_dibernardo
Multimodal Residual Learning for Visual Question-Answering
Review_Cibe Sridharan
SchNet: A continuous-filter convolutional neural network for modeling quantum...
Mining Frequent Closed Graphs on Evolving Data Streams
Hate Speech in Pixels: Detection of Offensive Memes towards Automatic Moderation
Ad

Viewers also liked (20)

DOCX
Simple Verb tense review: Present, Past, and Future
PPTX
Andrea GarcíA
PPT
HoteleríA Y Turismo01
PDF
05210202 F L U I D M E C H A N I C S A N D H Y D R A U L I C M A C H I...
PPTX
Turbo IT (маркетинг-кит)
PDF
Centro de aprendizaje turismo creativo y sostenible
PDF
Employee influence on retail crowding effects the mediating role of responsiv...
PPTX
Presentación2 enseñanza x ordenador
PPTX
MAPA CONCEPTUAL DE INGIENERIA ECONOMICA erol
PPTX
Md Liton Ali
PPTX
Andrea GarcíA
PDF
R05010303 C O M P U T E R P R O G R A M M I N G A N D N U M E R I C A L M E ...
PDF
Депутатский запрос по ботам налога на интернет
DOCX
simple outline for an essay
PDF
رحلة الخماسين المقدسة
DOCX
Industri minyak jagung
PPTX
Disruption. Fra forsvar til angreb - med bevidst innovation
PPTX
Gerunds: as subjects and objects
PDF
R05010105 A P P L I E D M E C H A N I C S
DOC
Pembahasn jurnal
Simple Verb tense review: Present, Past, and Future
Andrea GarcíA
HoteleríA Y Turismo01
05210202 F L U I D M E C H A N I C S A N D H Y D R A U L I C M A C H I...
Turbo IT (маркетинг-кит)
Centro de aprendizaje turismo creativo y sostenible
Employee influence on retail crowding effects the mediating role of responsiv...
Presentación2 enseñanza x ordenador
MAPA CONCEPTUAL DE INGIENERIA ECONOMICA erol
Md Liton Ali
Andrea GarcíA
R05010303 C O M P U T E R P R O G R A M M I N G A N D N U M E R I C A L M E ...
Депутатский запрос по ботам налога на интернет
simple outline for an essay
رحلة الخماسين المقدسة
Industri minyak jagung
Disruption. Fra forsvar til angreb - med bevidst innovation
Gerunds: as subjects and objects
R05010105 A P P L I E D M E C H A N I C S
Pembahasn jurnal
Ad

Similar to 05211201 A D V A N C E D D A T A S T R U C T U R E S A N D A L G O R I T H M S (20)

PDF
212101 Object Oriented Analysis Design Through Uml
PDF
212101 Object Oriented Analysis Design Through Uml
PDF
D A T A B A S E M A N A G E M E N T S Y S T E M S J N T U M O D E L P A P ...
PDF
Databasemanagementsystems Jntu Model Paper{Www.Studentyogi.Com}
PDF
Ooad q.papers
PDF
0502 Object Oriented Programming Through Java Set1
PDF
0502 Object Oriented Programming Through Java Set1
PDF
Computer Programming Jntu Model Paper{Www.Studentyogi.Com}
PDF
C O M P U T E R P R O G R A M M I N G J N T U M O D E L P A P E R{Www
PDF
PDF
Automata And Compiler Design
DOC
PDF
C O M P U T E R N E T W O R K S J N T U M O D E L P A P E R{Www
PDF
Computer Networks Jntu Model Paper{Www.Studentyogi.Com}
PDF
C g.2010 supply
PDF
2009 Punjab Technical University B.C.A Object Oriented Proagramming Language ...
PDF
07 A1 Ec01 C Programming And Data Structures
PDF
C O M P U T E R O R G A N I Z A T I O N J N T U M O D E L P A P E R{Www
PDF
Computer Organization Jntu Model Paper{Www.Studentyogi.Com}
PDF
R05010106 C P R O G R A M M I N G A N D D A T A S T R U C T U R E S
212101 Object Oriented Analysis Design Through Uml
212101 Object Oriented Analysis Design Through Uml
D A T A B A S E M A N A G E M E N T S Y S T E M S J N T U M O D E L P A P ...
Databasemanagementsystems Jntu Model Paper{Www.Studentyogi.Com}
Ooad q.papers
0502 Object Oriented Programming Through Java Set1
0502 Object Oriented Programming Through Java Set1
Computer Programming Jntu Model Paper{Www.Studentyogi.Com}
C O M P U T E R P R O G R A M M I N G J N T U M O D E L P A P E R{Www
Automata And Compiler Design
C O M P U T E R N E T W O R K S J N T U M O D E L P A P E R{Www
Computer Networks Jntu Model Paper{Www.Studentyogi.Com}
C g.2010 supply
2009 Punjab Technical University B.C.A Object Oriented Proagramming Language ...
07 A1 Ec01 C Programming And Data Structures
C O M P U T E R O R G A N I Z A T I O N J N T U M O D E L P A P E R{Www
Computer Organization Jntu Model Paper{Www.Studentyogi.Com}
R05010106 C P R O G R A M M I N G A N D D A T A S T R U C T U R E S

More from guestd436758 (20)

PDF
R05010501 B A S I C E L E C T R I C A L E N G I N E E R I N G
PDF
R05010107 E N G I N E E R I N G G R A P H I C S
PDF
E C M2221 P R O B A B I L I T Y A N D S T A T I S T I C S Set1
PDF
R05010401 N E T W O R K A N A L Y S I S
PDF
R05010204 E L E C T R O N I C D E V I C E S A N D C I R C U I T S
PDF
R05010203 E L E C T R I C A L C I R C U I T S
PDF
R05010302 E N G I N E E R I N G M E C H A N I C S
PDF
05210401 P R O B A B I L I T Y T H E O R Y A N D S T O C H A S T I C P R...
PDF
05212201 C A L I B R A T I O N A N D E L E C T R O N I C M E A S U R E ...
PDF
05210202 Fluid Mechanics And Hydraulic Machinery
PDF
05322201 Microprocessors And Microcontrollers Set1
PDF
Ce052391 Environmental Studies Set1
PDF
Ce 2009 Gate Paper Prsolutions08
PDF
Downstream Processing
PDF
E105309 Industrial Instrumentation Set1
PDF
Ec05032 Analog Communications Set1
PDF
210502 Mathematical Foundation Of Computer Science
PDF
22301 Analytical Techniques In Bio Technology Set1
PDF
20404 Electromagnetic Waves And Transmission Lines
PDF
12302 Basic Electrical And Electronics Engineering
R05010501 B A S I C E L E C T R I C A L E N G I N E E R I N G
R05010107 E N G I N E E R I N G G R A P H I C S
E C M2221 P R O B A B I L I T Y A N D S T A T I S T I C S Set1
R05010401 N E T W O R K A N A L Y S I S
R05010204 E L E C T R O N I C D E V I C E S A N D C I R C U I T S
R05010203 E L E C T R I C A L C I R C U I T S
R05010302 E N G I N E E R I N G M E C H A N I C S
05210401 P R O B A B I L I T Y T H E O R Y A N D S T O C H A S T I C P R...
05212201 C A L I B R A T I O N A N D E L E C T R O N I C M E A S U R E ...
05210202 Fluid Mechanics And Hydraulic Machinery
05322201 Microprocessors And Microcontrollers Set1
Ce052391 Environmental Studies Set1
Ce 2009 Gate Paper Prsolutions08
Downstream Processing
E105309 Industrial Instrumentation Set1
Ec05032 Analog Communications Set1
210502 Mathematical Foundation Of Computer Science
22301 Analytical Techniques In Bio Technology Set1
20404 Electromagnetic Waves And Transmission Lines
12302 Basic Electrical And Electronics Engineering

Recently uploaded (20)

PDF
What if we spent less time fighting change, and more time building what’s rig...
PDF
Paper A Mock Exam 9_ Attempt review.pdf.
PPTX
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PPTX
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
PDF
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf
PDF
Indian roads congress 037 - 2012 Flexible pavement
PDF
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
PPTX
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
PDF
Classroom Observation Tools for Teachers
PDF
Trump Administration's workforce development strategy
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
Introduction to Building Materials
PDF
SOIL: Factor, Horizon, Process, Classification, Degradation, Conservation
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PDF
Hazard Identification & Risk Assessment .pdf
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
What if we spent less time fighting change, and more time building what’s rig...
Paper A Mock Exam 9_ Attempt review.pdf.
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
Supply Chain Operations Speaking Notes -ICLT Program
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf
Indian roads congress 037 - 2012 Flexible pavement
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
Classroom Observation Tools for Teachers
Trump Administration's workforce development strategy
Chinmaya Tiranga quiz Grand Finale.pdf
Final Presentation General Medicine 03-08-2024.pptx
Introduction to Building Materials
SOIL: Factor, Horizon, Process, Classification, Degradation, Conservation
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
Hazard Identification & Risk Assessment .pdf
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...

05211201 A D V A N C E D D A T A S T R U C T U R E S A N D A L G O R I T H M S

  • 1. 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
  • 2. 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
  • 3. 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
  • 4. 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
  • 5. 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
  • 6. 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
  • 7. www.studentyogi.com www.studentyogi.com Code No: R05211201 Set No. 4 Figure 8b 2 of 2 www.studentyogi.com www.studentyogi.com