CS 6301 - Programming and Data Structure
CS 6301 - Programming and Data Structure
Third Semester
(Regulations 2013)
PART B - (5 x 13 = 65 marks)
11. (a) Define class and object. Explain different types of constructors using C++
Program.
Or
(b) Explain the different types of storage classes of C++ usmg suitable
examples.
12. (a) Demonstrate the following string operations using C++ p:rogram -
(i) finding the length of string (ii) finding the substring from the string
(iii) replace a given substring in a string (iv) concatenate two strings .
(v) compare two strings (vi) insert a substring in a given string.
Or
(b) Assume the classes Person Student and PartTimeStudent are inherited
from one another. Define classes with suitable data members (common
and special attributes) and methods using C++ program to demonstrate
the types of inheritance.
13. (a) (i) Define STL. Explain its key components and types. (5)
(ii) Write C++ code using function template to sort the items of an
array. (8)
Or
(b) (i) Write C++ file handling routine to copy one content of file into
another file. (7)
14. (a) (i) Merge the given Binomial heaps. Write procedure for merge
operation. (5+3)
H1: 0 0{ H2:
G
0
(ii) Delete three elements from the merged Binomial Queue. (5)
Or
(b) (i) Draw B-tree of order m = 5 for the keys
{K,0, S, V, M, F, B, G, T, U, W}. (6)
(ii) Delete the keys K and G in order. (4)
(iii) Justify the number of splits needed for insert/delete with proper
re~M. ~
2 71673
15. (a) Consider the following graph. Determine the shortest distance to all
other nodes using Dijikstra's algorithm. Write Procedure. (10+3)
Or
(b) Determine the minimum spanning tree of a given Graph using Kruskal's
algorithm. Write Kruskal's MST algorithm. (10+3)
PART C - (1 x 15 = 15 marks)'
16. (a) Assume the following keys form the Binary Search tree {50, 30, 60, 40,
35, 80, 90}. Analyze the time complexity involved in searching the keys
90 and then 80, when the given BST is converted into AVL or Splay tree.
Identify the suitable tree data structure for representing this data and
justify your answer with valid reasons.
Or
(b) The Manager, class is derived from Employee class. Use C++ virtual
function to calculate salary of EmployeelManager class. Increments for
employees differ based on their category. Assume suitable common and
special attributes for the classes. Implement this scenario using C++ code
to calculate the monthly and annual payment of each employee category.
3 71673