Code No: 133AG
R16
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD
B.Tech II Year I Semester Examinations, November/December - 2017
DATA STRUCTURES THROUGH C++
(Common to CSE, IT)
Time: 3 Hours Max. Marks: 75
Note: This question paper contains two parts A and B.
Part A is compulsory which carries 25 marks. Answer all questions in Part A.
Part B consists of 5 Units. Answer any one full question from each unit.
Each question carries 10 marks and may have a, b, c as sub questions.
PART- A
(25 Marks)
1.a) Define Time Complexity. [2]
b) What is a copy constructor? [3]
c) Define a node of Single linked list in C++. [2]
d) With a neat diagram represent 4 elements (21, 30, 12, 11) in Circular linked list. [3]
e) Define node of a threaded binary tree. [2]
f) Define height of a binary tree. [3]
g) Write worst case time complexity of quick sort. [2]
h) Define Collision in hashing. [3]
i) Define Red black tree. [2]
j) Differentiate between directed and Undirected graph. [3]
PART-B
(50 Marks)
2.a) Write a C++ program to swap two numbers using function templates.
b) Differentiate between function overloading and function overriding. [5+5]
OR
3.a) Write a C++ program to overload + operator to concatenate two strings.
b) Define big- O notation and theta notation? Give examples. [5+5]
4.a) Write a Program to push an element into a stack.
b) Write an algorithm to convert infix expression into postfix. [5+5]
OR
5.a) Write a program to delete an element from a circular queue.
b) Write a program to delete an element from single linked list. [5+5]
6.a) What are the properties of a binary tree?
b) Draw all possible binary tree whose inorder traversal is 3, 4, 5. [5+5]
OR
7.a) Create max heap for the following elements
(28, 16, 14, 103, 52, 105, 139, 27, 190)
b) If number of elements in a binary search tree are N. Give two sample binary search tree
where the search time is proportional to i) Log N ii) N [5+5]
WWW.MANARESULTS.CO.IN
8.a) Write a C++ Program to search an element using binary search.
b) Trace the above program to search 23 in the following elements 12, 15, 18, 20, 22, 36,
39, 40, 46 which is unsuccessful search. [5+5]
OR
9.a) Write a C++ program to sort the following elements using Recursive Merge Sort.
b) Trace the above program for the following elements:
12, 22, 54, 19, 11, 84, 63, 17, 15, 4, 13 [5+5]
10.a) Create binary search tree for the following elements ( 23, 32, 24, 36, 15, 12, 39, 2, 19).
Discuss about the height of the above binary search tree.
b) Discuss about different ways of representing Graphs in memory. [5+5]
OR
11.a) Write an algorithm to traverse a graph using breadth first search.
b) Explain about adjacency matrix and adjacency list. [5+5]
---oo0oo---
WWW.MANARESULTS.CO.IN