0% found this document useful (0 votes)
72 views1 page

nit data structure

This document is an end-semester exam paper for B.Tech 5th semester students at the National Institute of Technology Hamirpur, focusing on Data Structures. It includes seven questions covering various topics such as linear and circular queues, merge sort, hashing, heapsort, depth-first search, binary search trees, and binary tree construction. Each question requires detailed explanations, examples, and complexity analyses, with a total of 50 marks allocated for the exam.

Uploaded by

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

nit data structure

This document is an end-semester exam paper for B.Tech 5th semester students at the National Institute of Technology Hamirpur, focusing on Data Structures. It includes seven questions covering various topics such as linear and circular queues, merge sort, hashing, heapsort, depth-first search, binary search trees, and binary tree construction. Each question requires detailed explanations, examples, and complexity analyses, with a total of 50 marks allocated for the exam.

Uploaded by

yasiraldossari2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Scholar No.

:
Name of student .
Y\ L.---1/4,
National Ins ute of Technology Hamirpur
Department of Computer Science & Engineering
End-Semester Exam Nov-2023

Branch: B.Tech 5' Sem


Subject: Open Elective (Data Structures) Max Marks: 50
Max Time: 03:00 hrs
Code: CS-306

Note: 1. All questions are compulsory.


2. Draw neat diagrams wherever necessary.
3. For the questions that are of one word or two words or one sentence answer,
you also have to write the logic or procedure to get the answer.

Q I . What is the limitation of linear queue? Why circular queue is needed? Explain with proper
[7 Marks]
example using insertion and deletion operation.

Q2. Describe merge sort algorithm with suitable example (using input array 1, 15, 24, 26, 2, 13,
[7 Marks]
27, 38). Also, give the worst time complexity analysis of the algorithm.

Q3. (a) What is hashing? What is collision? Flow collisions can be handled. Using the hash
function 'key mod 7', insert the following sequence of keys in the hash table- [7 Marks]
50, 700, 76, 85, 92, 73 and 101
Use linear and quadric probing techniques for collision resolution.
(b) Insert the keys 79, 69, 98, 72, 14, 50 into the Hash Table of size 13. Resolve all collisions
using Double Hashing where first hash-function is hi (k) = k mod 13 and second hash-
function is h2 (k) = 1 + mod 11).

Q4. Explain heapsort algorithm with its time and space complexity. Apply heapsort for following
I6, 14, I0, 8, 7, 9, 3, 2, 4. I }. [7 Marks]
input array A,-

Q5. Explain Depth first search graph traversal technique with its algorithm, time complexity using
[7 Marks]
following graph.

Q6. What is the limitation of Binary Search Tree explain with example. Explain how AVL tree
overcome this limitation. Construct AVL Tree for the following sequence of numbers-
50, 20 , 60 , 10 , 8 , 15 , 32 46 , 11 48 [7 Marks]

Q7. (a) The postorder traversal of a binary tree is 8, 9, 6, 7, 4, 5, 2, 3, 1. The inorder traversal of
the same tree is 8, 6, 9, 4, 7, 2, 5, I , 3. Construct a binary tree from postorder and inorder
traversal and calculate the height of the binary tree. [34-1+1+3=8 Marks]
(b) How many at least and at most number of elements is in a binary tree of height h, h >= 0?
(c) What is the at least and at most height of a binary tree that contains n elements, n >= 0?
(d) What is the time complexity of the following program? Explain your answer.
void fun (int n)

if(n<l)
return;
else
fun(n-1);
printf(''Yod", n);

You might also like