0% found this document useful (0 votes)
4 views2 pages

dsa nov131

Signal and Systems

Uploaded by

bhushanseelan786
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

dsa nov131

Signal and Systems

Uploaded by

bhushanseelan786
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 2
B.E/ B.TECH DEGREE END SEMESTER EXAMINATIONS, NOV/DEC 2013 THIRD SEMESTER ~ (REGULATIONS 2012) INFORMATION TECHNOLOGY 118303 Programming and Data Structures I Time: Three hours Maximum: 100 marks Answer ALL Questions. Part ~ A (10*2 = 20) Differentiate between a call by value and call by reference. When do we declare a member of a class as statie? How do we initialize it? What is a copy constructor? Is it possible to overload the 1wo methods ‘void fune() const” and ‘void fune()? Justify your answer What is an abstract class? Define namespace. What is the use of ‘using’ declaration? How Fibonacei heaps differ from binomial heaps? What is meant by Amortized Analysis? Show that the stack operation MULTIPOP costs O(1) amortized time. 9. What is meant by a cycle and loop? 10. What is the principle behind Bellman-Ford algorithm to detect negative weight cycles? Peary Part B -(16*5 =80) 11 i) Define a class Travel in C++ with private members Travel_Code, Place_of_type No_of travellers and No_of_buses, A constructor to assign initial values for the members. A function NewTravel( ) which allows user to enter values. A function ShowTravel( ) to display the content from alll the data members on screen. (10) 11 ii) When do we need to use default arguments in a function? Where does the default parameter can be placed by the user? Write a snippet code to explain. (6) 12.) i) Write a program to implement a Ratio class with members num, den. Overload arithmetic operator “+”, relational operator “= =”, stream operators that operate on the objects of Ratio and a conversion operator to convert a Ratio abject to a double value.. (0) 12a) ii) Discuss the need of a friend function with an example. © (OR) 12b) i) Define a class Shape with constructor, destructor and pure virtual functions GetArea() , GetPerim() and Draw(). Derive classes Circle and Rectangle from Shape. Derive another class Square from Rectangle. implement this hierarchy with constructors, destructors and essential functions, Write a main. (10) 12b ii) Explain how dynamic binding is achieved in the above hierarchy. © 3 13 a) i) Define template class Stack and implement generic methods to push and pop the elements from the stack. (10) 13 a) i) Write the code that creates an exception object to throw a divide by zero exception. (6) (OR) 13 b) i) Write a C+ program that writes into an existing file without destroying the existing contents and read from the file to display the file contents. (10) 13 b) fi) Discuss about the different components in STL. ©) 14 a) i) Perform the splaying operation on a binary search tree obtained by inserting the keys 1, 2, 3, 4, 5, 6, 7, 8 in this order into an initially empty tree. Write the code to do the same (splay and insert) (10) 14) ii) On an initially empty binomial heap, carry out the following sequence of ‘operations: insert(27), insert(17), insert(19), insert(20), insert(24), insert(12), insert(11), insert(10), insert(14), insert(18), deletemin. ‘After each operation, draw the resulting’structure of the binomial heap. (6) (OR) 14 b) i)Construct an AVE tree with values 3, 1, 4, 5, 9, 2, 6, 8, 7, 0 into an initially empty tree. Write the code for inserting into an AVL tree. (10) 14 b) il) Construct a B-tree with order m=3 for the key values 2, 3, 7, 9, 5,6, 4, 8 1 Delete the values 4 and 6. Show the tree in performing all operations. (6) aN Si Ow 15 a) ii) Describe how directed graphs can be traversed. 6) (OR) 15 b) i) What is a Minimum Spanning Tree? Name any two Minimum Spanning Tree (MST) algorithms. For a graph G given below, find its minimum spanning tree by explaining any one algorithm, (16)

You might also like