1 CS205 - DATA - STRUCTURES - QP MAIN JAN 2017 - Ktu Qbank
1 CS205 - DATA - STRUCTURES - QP MAIN JAN 2017 - Ktu Qbank
1 CS205 - DATA - STRUCTURES - QP MAIN JAN 2017 - Ktu Qbank
1. Compare and contrast singly linked list and doubly linked list. (3)
2. What do you understand by complexity of an algorithm? Write worst case and best case
complexity of linear search. (3)
3. Let LIST be a singly linked list in memory. Write an algorithm to find number of times a
given data item called ITEM occurs in LIST. (3)
4. Define the terms
a) Frequency count.
b) Stepwise refinement technique. (3)
PART B
(Answer Any Two Questions)
5. Describe the different notations used to describe the asymptotic running time of an
algorithm. (9)
6. How a linked list can be used to represent a polynomial 5x3+4x2+3x+2? Give an algorithm
to perform addition of two polynomials using linked list. (9)
7. Give an algorithm to perform following operations in a singly linked list.
(a) Insert a new node after a given node. (3)
(b) Delete last node. (3)
(c) Count the number of elements in the list. (3)
Page 1 of 3
PART C
(Answer ALL Questions)
PART D
(Answer Any Two Questions)
12. Write an algorithm for evaluating a postfix expression and evaluate the following postfix
expression using the algorithm AB+CD/AD-EA˄ + * where A=2, B=7, C=9, D=3, E=5
(9)
13. List the properties of binary search tree. Write an algorithm to search an element from a
binary search tree. (9)
14. a) Write the non recursive preorder traversal algorithm. (4.5)
b) What is the output obtained after preorder, inorder and postorder traversal of the
following tree. (4.5)
7 9
3 4
2
1 6 8
PART E
(Answer Any Four Questions)
15. Write an algorithm for merge sort technique. Illustrate with an example. Give its
complexity. (10)
Page 2 of 3
16. Give any two representations of graph. Give algorithm for DFS. Demonstrate DFS using
suitable example. (10)
17. Give an algorithm to perform binary search. Using the algorithm, search for elements 23
and 47 in the given set of elements[12 23 27 35 39 42 50]. (10)
18. a) Write algorithm for (i) Insertion sort (ii) Bubble sort (6)
b) Illustrate the insertion sort algorithm and bubble sort algorithm on input
[30,20,10,60,70,40] (4)
19. Define hashing. What are the properties of a good hash function? With necessary
examples explain four different hashing techniques. (10)
20. Define collision. What is linear probing? The following keys 10, 16, 11, 1, 3, 4,23 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? (10)
***