Professional Documents
Culture Documents
QP Format MID SEM 2
QP Format MID SEM 2
5. K3
Write the routines for tree traversal. Give the preorder, postorder and inorder
traversals for the following.
(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
3. K3
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