DATA STRUCTURES_Lateral Entry
DATA STRUCTURES_Lateral Entry
PART – A
1
(j) Int fun (int x, int y)
{
if (y==0)
return x;
else
return fun (y-2, x+y);
}
What does the above recursive function returns if x=3 and y=4.
PART - B
2.Answer any two: [7 x 2]
(a)Convert the given infix expression A+(B*C+(D/E^F)) into its postfix expression and
evaluate the same using stack. Here A=3, B=5, C=2, D=14, E=7, F=1.
(b) Explain about the data structure Queue. Write the algorithm to insert and delete of an
element to or from the queue.
(c)Write the steps to evaluate a prefix expression. Evaluate the following expression
written in prefix form by using stack and show the stack content for each step.
Prefix Expression: ^ / * + 8 / 6 3 2 5 4
2
3. Answer any two: [7 x 2]
(a) Write an algorithm to insert new node at the specific position and at the end of a
circular linked list.
(b) Write an algorithm to insert new node at the specific position and at the end of a
doubly linked list.
(a) Develop a binary search tree resulting after inserting the following integer keys 35, 46,
25, 12, 18, 55, 60, 28. (i) Determine the level of the tree (ii) Write post order and pre
order traversals.
(b) Discuss AVL tree and mention the need of rotations. Construct the AVL tree from the
given data: 15, 20, 24, 10, 13, 7, 30, 36, 25.
(c) What is a binary tree? Construct a binary tree given the pre-order traversal and inorder
traversals as follows:
Pre-Order Traversal: G B Q A C K F P D E R H
In-Order Traversal: Q B K C F A G P E D H R
(a) Show how the Floyd Warshall algorithm works on following graphs. The source
vertices are denoted by circle.
.
3
(b) Name the data structures used for Breadth first traversal of a graph. By using Breadth
first search (BFS) algorithm, clearly discuss the steps to find the sequence in which
vertices of the following graph are traversed starting from vertex “e “.
(a) You are using some sorting algorithm for the given numbers 10,80,20,40,5,15 to sort it
in ascending order. Perform Quick sort for the following elements. Explain all passes
for Quick sort.
(b) Discuss hashing mechanism with proper example. Explain collision resolution
technique in hashing with suitable example.
CO2 Analyze and design of linear data Q1.c + Q1.e + Q1.i + Q3.a + Q3.b + Q3.c
27
structure such as Linked List for solving = (2+2+2 +7+7+7)
problems.
CO3 Analyze and design of non-linear data Q1.l + Q1.o + Q1.h + Q4.a + Q4.b + Q4.c 27
structure such as Tree for solving = (2+2+2+7+7+7)
problems.
CO4 Analyze and design of non-linear data Q1.f +Q1.n+ Q5.a + Q5.b =(2+2+7+7) 18
structure such as Graph for solving
problems.
CO5 Use different sorting and searching Q1.k + Q1.m + Q6.a + Q6.b = (2+2+7+7) 18
mechanisms by analyzing suitability.