Data Structures, III Sem, June 2019
Data Structures, III Sem, June 2019
Note: Answer ALL questions in Part-A and any FIW from Part-B
Part-A(10x2=20Marks)
I What is the matrix which has more number of zero entries? How it can be
represented effi ciently.
2. Determine the time complexity of the following C function.
void add( int a[ ][MAX_SIZE], int b[ ][MAX_SIZE], int c [ ][MAX_SIZE],
int rows, int colsl
{
int i, j;
for(i-0;i<rows;i++)
for(=oioo" '**,
ctilUl=atiltjl - bliltjl:
)
) Desiga a function to double the size ofa stack evory time when it becomes
tull .
4 Given the elements stored in doubly linked list as shown below.
h7*
lo
'--'l* t'
,*
3000 zxx) r
L00(} l5 z0 ,.ooo
Show how these elements are stored in a singly linked list data structure with
the help ofa diagram. AIso represent the address information in the nodes
5 Write a function to find the number of [eaf nodes in a binary tree.
6 Find the minimum cost spanning tree for the given graph using Kruskal's
algorithm
5
a
7 Which sorting technique is more suitable for the given data set.
t2 t4 56 4s 78 89 90
8 What is hashing ? List the hashing techniques.
10. Design an algorithm to find the balance lactor ofeach node in an AVL tree
Contd. ..2
2 Code No:13212 S
Part-B(5X8=40)
(AIl Sub-Questions carry equal marks)
ll. a) Design a function to insert the element'n' in the ks position ofthe linked list.
13. a) Design a function to insert an element into the binary search tree.
b) Write the algorithm to perform DFS on a given graph. Write the 4 DFS for the follorving
graph from node D,
14. a) Design an algorithm to sort the elements using merge sort technique
b) Given the hash function h=key mod 10, where l0 is the sizc ofthe hash table. Insert the
following data into hash table. Use linear probing to address the collisions.
25, 146, 304, I t0, 550, 696, 88, 28, 97, 7 6
15. a) What is splay tree ? Explain inserting an element into a splay tree with example.
b) Construct an AVL tree by specifying the type ofthe rotations performed while inserting
elements
1025 45 1220 ts25
16. a) Explain the space and time complexities of an algorithm with example.
b) Show the heap structure and sequence of elements during each iteration of heap sort
algorithm when applied to following sct of elements.
45 125 150 80 40 95 15 450 100
c) Explain inserting an element into a B-tree rvith example.