Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 4

SET 1

DEPARTMENT OF ARTIFICIAL INTELLIGENCE AND DATA SCIENCE


MID SEMESTER - 2 EXAMINATION
18AIC203J - DATA STRUCTURES AND ALGORITHMS

Year/Semester & Branch: II/III & AI&D Date:


Faculty Name: Ms.A.Nithyasri Max. Marks: 100 Time:

PART-A Answer ALL Questions (10x2=20 Marks)


1. How do you find depth and height of the tree? Give example. CO3 K1
Why it is said that searching a node in a binary search tree is efficient than that CO3
2. K2
of a simple binary tree?
3. Define AVL Tree. CO3 K1
4. What do you mean by structure property in heap? CO3 K1
Show the result of inorder traversal of the binary search tree given in figure. CO3

5. K3

6. Compare linear and binary search algorithm techniques. CO4 K2


7. What do mean by heap? CO4 K1
8. Recall internal and external sorting? CO4 K1
9. Mention the collision handling techniques. CO4 K1
Showing the result of sorting the following numbers using radix sort. (step by
10. CO4 K3
step o/p). 4, 7, 3, 2, 5, 1, 6

PART-B Answer ALL Questions (5x16=80 Marks)

Write the routines for tree traversal. Give the preorder, postorder and inorder
traversals for the following.

11. (a) CO3 K3

(or)
SET 1

Write the following routines to implement the basic binary search tree
operations.
11. (b) CO3 K1
(i) Perform Insertion and Deletion operation in binary search tree. (10)
(ii) Find_min and Fin_max. (6)
i) Derive expression tree and write the procedure for constructing an
expression tree. (8)
12. (a) ii) Construct an expression tree for the expression (a+b*c) + ((d*e+f)*g). CO3 K2
Give the outputs when you apply inorder, preorder and postorder traversals.
(8)
(or)
Write a routine for AVL tree insertion and insert the following elements in
12. (b) the empty tree and how do you balance the tree after each element insertion? CO3 K3
14, 8, 12, 46, 23, 5, 77, 88, 20.
Create a B Tree of order 5 by inserting the following elements: 3, 14, 7, 1, 8,
13. (a) 5, 11, 17, 13, 6, 23, 12, 20, 26, 4, 16, 18, 24, 25 and 19 CO3 K3
(or)
Discuss in detail about Min heap and Max heap and build the max heap for
13. (b) the following sequence 80, 150, 70, 40, 100, 20, 30, 10, 110, 90, 60, 50, 120. CO3 K3
Show the result of sorting using delete max.
Write a routine for Insertion sort. Sort the following sequences using
Insertion sort. 3, 10, 4, 2, 8, 6, 5, 1. (8)
14. (a) CO4 K3
Sort the following list of numbers using bubble sort technique 52, 1, 27, 85,
66, 23, 13, 57. (8)
(or)
i) Distinguish between linear search and binary search. State and explain the
routines for both the search with example. (8)
14. (b) ii) State and explain the shell sort. Write the routine for shell sort and the CO4 K2
following elements to be sort using shell sort. 25, 57, 48, 37, 12, 92, 86, 33.
(8)
Explain in detail about selection sort and radix sort. sort the following using
15. (a) it. 70,30,20,50,60,10,40. CO4 K3
(or)
Consider a hash table with 9 slots. The hash function is h(k) = K mod 9.
The following keys are inserted in the order 5, 28, 19, 15, 20, 33, 12, 17, 10.
Draw the contents of the hash table when the collision are resolved by
15 (b) i) Chaining CO4 K3
ii) Linear probing
iii) Double hashing. The second hash function h2(x) = 7 – (x mod 7)

Knowledge Remember (K1), Understand (K2), Apply (K3), Analysis (K4), Evaluate (K5) & Design
Level (K) (K6)

*****

Verified by Approved By

DEPARTMENT OF ARTIFICIAL INTELLIGENCE AND DATA SCIENCE


SET 1

MID SEMESTER - 2 EXAMINATION


18AIC203J - DATA STRUCTURES AND ALGORITHMS
Year/Semester & Branch: II/III & AI&D Date:
Faculty Name: Ms.A.Nithyasri Max. Marks: 100 Time:
PART-A Answer ALL Questions (10x2=20 Marks)
1. Define complete binary tree. CO3 K1
2. Difference between binary tree and binary search tree. CO3 K2
For the tree in figure. CO3
A) List the siblings for node E.
B) Compute the height.

3. K3

4. Enlist the properties of B-trees. CO3 K1


5. Write down the basic terminologies of tree. CO3 K1
6. Mention the advantages of binary search over the linear search. CO4 K2
7. List out the four internal sorting techniques. CO4 K1
Sort the following numbers using Insertion sort.
8. CO4 K3
9 5 2 3 26 1 4 53 46 8 17
9. State radix sort. CO4 K1
10. Define rehashing. CO4 K2

PART-B Answer ALL Questions (5x16=80 Marks)

i) Construct a binary tree to satisfy the following orders: (8)


Inorder: 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 15, 19, 20
11. (a) Post order: 3, 2, 5, 6, 4, 8, 11, 9, 15, 20, 19, 12, 7 CO3 K2
ii) Write the routine to perform the inorder and post order tree traversal. (8)
(or)
i) Write suitable ADT’s to perform insertion and deletion operations in
binary search tree. (8)
ii) Simulate the result of inserting: 61, 32, 36, 14, 6, 75, 82, 3, 19, 87, 94 one
11. (b) CO3
at a time, into an initially empty binary tree. (4)
iii) Simulate the deletion of the elements 36, 87, 61, 75 one by one from the
above binary search tree. (4)
Construct an expression tree for the following expression (a + b*c)+(d*e +
12. (a) CO3
f)*g
(or)
12. (b) Write the four AVL rotation functions only. (8) CO3
Show the result of inserting 2, 1, 4, 5, 9, 3, 6 and 7 into an initially empty
SET 1

AVL tree. Specify the type of rotation after each iteration. (8)
Construct B Tree of order m=5 for the following keys
13. (a) 1,12,8,2,25,5,14,28,17,7,52,16,48,68,3,26,29,53,55,45. Delete the keys 8 and CO3
55. State the rules for deletion.
(or)
Discuss in detail about Min heap and Max heap. Construct max heap for
13. (b) elements 14, 12, 9, 8, 7, 10, 18. And after deleting keys 18 & 14 show the CO3
result of heap structure
Sort the sequence 96, 31, 27,42,76,61,10,4 using shell sort and radix sort and
14. (a) CO4
prepare the required steps.
(or)
Examine the algorithm for Insertion sort and sort the following array: 77, 33,
14. (b) 44, 11, 88, 22, 66, 55 CO4
Interpret an algorithm to sort a set of ‘N’ numbers using bubble sort and
15. (a) demonstrate the sorting steps for the following set of numbers: CO4
88,11,22,44,66,99,32,67,54,10.
(or)
15 (b) Explain the collision resolving schemes in hashing with proper illustrations. CO4

Knowledge Remember (K1), Understand (K2), Apply (K3), Analysis (K4), Evaluate (K5) & Design
Level (K) (K6)

*****
Verified by Approved By

You might also like