ds model
ds model
2. (a) Implement the basic stack operations PUSH, POP, DISPLAY using a list?
[BL: Understand | CO 3| Marks:6]
(b) Suppose a circular queue of capacity ( n-1 ) elements is implemented with an array of n
elements. Assume that the insertion and deletion operation are carried out using REAR
and FRONT as array index variables, respectively. Initially, REAR = FRONT= 0. Find
the conditions to detect queue full and queue empty by using the following conditions.
1. Full: (REAR+1) mod n == FRONT, empty: REAR == FRONT
2. Full: (REAR+1) mod n == FRONT, empty: (FRONT+1) mod n == REAR
3. Full: REAR == FRONT, empty: (REAR+1) mod n == FRONT
4. Full: (FRONT+1) mod n == REAR, empty: REAR == FRONT
[BL:Apply | CO 3| Marks:6]
MODULE-III
3. (a) Write an algorithm/program to implement following operations in the Singly Linked list?
(i) Insert the node at end
(ii) Delete the node whose value = Y.
[BL: Apply | CO 3| Marks:6]
(b) Write a function to implement the basic operations of a doubly linked list.
[BL: Understand | CO 3| Marks:6]
4. (a) What are the advantages of doubly linked list? Write a function to find maximum element
from doubly linked list [BL: Understand | CO 6| Marks:6]
(b) Write an algorithm to insert a node before a given node in a singly linked list. Is it
advantageous to use a doubly linked list for this operation? Explain.
[BL: Analyze | CO 6| Marks:6]
MODULE-IV
5. (a) Briefly explain advantages of binary search tree. Construct binary search tree for the
following elements
8, 3, 11, 5, 9, 12, 13, 4, 6, 20 [BL: Apply | CO 4| Marks:6]
(b) The in-order and preorder traversal of a binary tree are
dbeafcg
a b d e c f g respectively
Construct binary tree and find its post-order traversal
[BL: Apply | CO 4| Marks:6]
7. (a) Create a Binary Search Tree for the following data and do In-order, Preorder and Post-
order traversal of the tree.
50, 60, 25, 40, 30, 70, 35, 10, 55, 65, 5 [BL: Apply | CO 4| Marks:6]
(b) The keys 12, 18, 13, 2, 3, 23, 5 and 15 are inserted into an initially empty hash table of
length 10 using open addressing with hash function h(k) = k mod 10 and linear probing.
What is the resultant hash table? [BL: Apply | CO 5| Marks:6]
8. (a) What do you mean by hashing? What are the various hash functions? Explain each one
in brief. [BL: Understand | CO 5| Marks:6]
(b) Define AVL tree. Construct AVL tree for following data
10,20,30,40,50,60,70,80
[BL: Apply | CO 3| Marks:6]
**END OF EXAMINATION**
Page 2
COURSE OBJECTIVES:
The course should enable the students to:
COURSE OUTCOMES:
After successful completion of the course, students should be able to:
Page 3
b Suppose a circular queue of capacity n-1 Apply CO 3 PO 1,
elements is implemented with an array of n PO 2,
elements. Assume that the insertion and deletion PO 3
operation are carried out using REAR and
FRONT as array index variables, respectively.
Initially, REAR = FRONT= 0. Find the
conditions to detect queue full and queue empty
by using the following conditions. 1. Full:
(REAR+1) mod n == FRONT, empty: REAR
== FRONT 2. Full: (REAR+1) mod n ==
FRONT, empty: (FRONT+1) mod n == REAR
3. Full: REAR == FRONT, empty: (REAR+1)
mod n == FRONT 4. Full: (FRONT+1) mod n
== REAR, empty: REAR == FRONT
a Write an algorithm/program to implement Apply CO 3 PO 1,
3
following operations in the Singly Linked list? PO 2,
(i) Insert the node at end PO 3,
(ii) Delete the node whose value = Y. PO 10
b Write a function to implement the basic Understand CO 3 PO 1,
operations of a doubly linked list. PO 2,
PO 3
a What are the advantages of doubly linked list? Understand CO 6 PO 1,
4
Write a function to find maximum element from PO 2,
doubly linked list PO 3,
PO 10
b Write an algorithm to insert a node before a Analyze CO 6 PO 1,
given node in a singly linked list. Is it PO 2,
advantageous to use a doubly linked list for this PO 3,
operation? Explain. PO 10
a Briefly explain advantages of binary search tree. Apply CO 4 PO 1,
5
Construct binary search tree for the following PO 10
elements
8,3,11,5,9,12,13,4,6,20
b The in-order and preorder traversal of a binary Apply CO 4 PO 1,
tree are d b e a f c g PO 2,
a b d e c f g respectively PO 3,
Construct binary tree and find its post-order PO 10
traversal.
a Create a B-tree of order 5 by inserting the Apply CO 6 PO 1,
6
following data values. PO 2,
D, H, K, Z, B, P, Q, E, A, S, W, T, C, L, N, Y, PO 3,
M PO 10
Page 4
b Define directed graph, spanning tree and Apply CO 6 PO 1,
minimum spanning tree. Find minimum PO 2,
spanning tree for the graph shown in Figure PO 3,
PO 10
1.
a Create a Binary Search Tree for the following Apply CO 4 PO 1,
7
data and do In-order, Preorder and Post-order PO 2,
traversal of the tree. PO 3,
50, 60, 25, 40, 30, 70, 35, 10, 55, 65, 5 PO 10
b The keys 12, 18, 13, 2, 3, 23, 5 and 15 are Apply CO 5 PO 1,
inserted into an initially empty hash table of PO 2,
length 10 using open addressing with hash PO 3,
function h(k) = k mod 10 and linear probing. PO 10
What is the resultant hash table?
a What do you mean by hashing? What are the Understand CO 5 PO 1,
8
various hash functions? Explain each one in PO 10
brief.
b Define AVL tree. Construct AVL tree for Apply CO 3 PO 1,
following data PO 2,
10,20,30,40,50,60,70,80 PO 3,
PO 10
Page 5
KNOWLEDGE COMPETENCY LEVELS OF MODEL QUESTION PAPER
10
9
6
Count 6
2
1
0 0 0
0
ly
e
r
nd
te
z
be
at
pp
ly
ua
ta
re
em
na
A
al
rs
C
Ev
A
em
e
nd
R
Page 6