USN 15CS33
Third Semester B.E. Degree Examination, Dec.2016/Jan.2017
Data Structures and Applications
Time: 3 hrs. Max. Marks: 80
Note: Answer FIVE full questions, choosing one full question from each module.
2. Any revealing of identification, appeal to evaluator and /or equations written eg, 42+8 = 50, will be treated as malpractice.
Module-1
1 a. What is an algorithm? Explain the criteria that an algorithm must satisfy. (08 Marks)
b. Write a function to sort integers using selection sort algorithm. (04 Marks)
c. Consider two polynomials,
A( x ) 4x 15 3x 4 5 and B( x ) x 4 10 x 2 1
Important Note : 1. On completing your answers, compulsorily draw diagonal cross lines on the remaining blank pages.
Show deagramatically how these two polynomials can be stored in a 1-D array. Also give its
C representation. (04 Marks)
OR
2 a. Write the Knuth Morris Pratt pattern matching algorithm and apply the same to search the
pattern ‘abcdabcy’ in the text ‘abcxabcdabxabcdabcdabcy’. (08 Marks)
b. Write the fast transpose algorithm to transpose the given sparse matrix. Express the given
sparse matrix as triplets and find its transpose.
10 0 0 25 0
0 23 0 0 45
0 0 0 0 32
A (08 Marks)
42 0 0 31 0
0 0 0 0 0
0 0 30 0 0
Module-2
3 a. Write the algorithm to implement a stack using dynamic array whose initial capacity is 1 and
array doubling is used to increase the stack’s capacity (that is dynamically reallocate twice
the memory) whenever an element is added to a full stack. Implement the operations-push,
pop and display. (08 Marks)
b. Write the algorithm for of tower of Hanoi. (04 Marks)
c. Write a note on Ackerman’s function. (04 Marks)
OR
4 a. List the disadvantages of linear queue and explain how is it solved in circular queue. Give
the algorithm to implement a circular queue with suitable example. (08 Marks)
Convert the infix expression, a /(b c d * (e a ) * c to postfix expression. Write a
b.
function to evaluate that postfix expression and trace for the given data a 6 , b = 3, c = 1,
d = 2, e = 4. (08 Marks)
1 of 2
15CS33
Module-3
5 a. Give the node structure to create a singly linked list of integers and write functions to
perform the following :
(i) Create a list.
(ii) Assume the list contains 3 nodes with data 10, 20, 30. Insert a node with data 40 at the
end of the list.
(iii) Insert a node with data 50 between the nodes having data values 10 and 20.
(iv) Display the singly linked list. (08 Marks)
b. What is the advantage of doubly linked list over singly linked list? Illustrate with an
example. (04 Marks)
c. For the given sparse matrix, write the diagrammatic linked list representation.
0 10 0 0
3 0 0 5
A 8 0 2 0 . (04 Marks)
0 0 0 0
0 0 8 0
OR
6 a. Write the functions for singly linked list with integer data to search an element in the list.
(08 Marks)
b. Write the node structure for linked representation of polynomial. Explain the algorithm to
add two polynomials represented using linked lists. (08 Marks)
Module-4
7 a. What is a tree? With suitable example define (i) Binary tree (ii) Level of a binary tree
(iii) Complete binary tree. (08 Marks)
b. Write the routines to traverse the given tree using (i) Pre-order traversal and (ii) Post order
traversal. (08 Marks)
OR
8 a. What is a binary search tree? Write algorithm to implement for recursive search or iterative
search for a binary search tree. (08 Marks)
b. Write the routines for, (i) Create a binary tree. (ii) Testing for equality of binary trees.
(08 Marks)
Module-5
9 a. What is a graph? Give the matrix and adjacency list representation of graphs. (08 Marks)
b. Write an algorithm for bubble sort. Trace the algorithm for the data :
30, 20, 10, 40, 80, 60, 70. (08 Marks)
OR
10 a. Explain open addressing and chaining used to handle overflows in hashing. (05 Marks)
b. Explain directoryless dynamic hashing. (05 Marks)
c. Briefly explain basic operations that can be performed on a file. Explain indexed sequential
file organization. (06 Marks)
*****
2 of 2