Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

B 331A3 Total Pages: 3

Register No.: ……………………………… Name: …………………………………………………………..

SAINTGITS COLLEGE OF ENGINEERING (AUTONOMOUS)


(AFFILIATED TO APJ ABDUL KALAM TECHNOLOGICAL UNIVERSITY, THIRUVANANTHAPURAM)
THIRD SEMESTERB.TECH DEGREE EXAMINATION (Regular), FEBRUARY 2022

COMPUTER SCIENCE AND ENGINEERING


(2020 SCHEME)
Course Code: 20CST201
Course Name: Data Structures
Max. Marks: 100 Duration: 3 Hours

PART A
(Answer all questions. Each question carries 3 marks)
1. What do you understand by complexity of an algorithm? Write worst case and best case
complexity of linear search?
2. Calculate the frequency count of the following code
void display()
{
int a,b,c;
a=10;
b=20;
c=a+b;
printf(“%d”,c);
}
3. Write an algorithm for first fit method for memory allocation.
4. Convert the following infix expression into prefix expression (A-B/C) * (D*E-F)
5. How will you check the validity of an arithmetic expression using stack
6. Represent the polynomial 3x2 +2xy2 +5y3 +7yz using singly linked list.
7. If a full binary tree is of height 5, give the positions of left child and right child of the second node in
level 2.
8. Draw the binary tree whose sequential representation is given below

9. Explain collision problem in hashing.


10. Give the heap sort algorithm. Write the complexity of your algorithm

Page 1 of 3
B 331A3 Total Pages: 3
PART B
(Answer one full question from each module, each question carries 14 marks)
MODULE I
11. a) What do you mean by space complexity and time complexity of an algorithm? Write an
algorithm/pseudo code for binary search and mention the best case and worst case time (8)
complexity of Linear Search algorithm?
b) Explain the System Life Cycle in detail. (6)
OR
12. a) Describe Big O notation used to represent asymptotic running time of algorithms. Give
(9)
the asymptotic analysis of any one iterative algorithm.
b) What is the complexity of finding maximum and minimum value from an array of n
(5)
values? Explain the steps of deriving complexity
MODULE II
13. a) Convert the following expression into its corresponding post fix form using the prescribed
(9)
algorithm: (300+23)*(43-21)/(84+7). Do the evaluation of resultant postfix expression
b) Illustrate the result of each operation in the sequence PUSH(S,4), PUSH(S,1), PUSH(S,3),
(5)
POP(S), PUSH(S,8) and POP(S) on an initially empty stack S stored in array S[1..6]
OR
14. a) Write an algorithm for deleting a node from a specified position in a circular queue (8)
b) Compare and contrast Circular Queue with a Normal Queue (6)
MODULE III
15. a) Write an algorithm to multiply two polynomials represented using linked list. (8)
b) Given a doubly linked list, write an algorithm that removes a node with a particular value
(6)
from the list and inserts it in the front.
OR
16. a) Given five memory partitions of 300Kb, 700Kb, 400Kb, 500Kb, 800Kb (in order), how
would the first-fit, best-fit, and worst-fit algorithms place processes of 412 Kb, 617 Kb, 112 (6)
Kb, and 626 Kb (in order)?
b) Give an algorithm to perform following operations in a singly linked list.
(a) Insert a new node after a given node.
(8)
(b) Delete last node.
(c) Count the number of elements in the list.
MODULE IV
17. a) Give any two representations of graph. Write the algorithm for DFS and demonstrate
with suitable example.
(9)

Page 2 of 3
B 331A3 Total Pages: 3
b) Draw the directed graph that corresponds to this adjacency matrix:
0 1 2 3
0 | true false true false |
1 | true false false false | (5)
2 | false false false true |
3| true false true false |

OR
18. a) Write an algorithm for binary search tree. Construct binary search tree using the following
(9)
elements [12 23 27 35 39 42 50].
b) What is the output obtained after preorder, inorder and postorder traversal of the
following tree.

(5)

MODULE V
19. a) Write an algorithm for merge sort technique. Illustrate with an example. Give its
(9)
complexity
b) Show all the passes using insertion sort for the following list 54,26,93,17,77,31,44,55,20 (5)
OR
20. a) Consider a hash table of size 7 and hash function h(k)= k mod 7. Draw the table that
results after inserting in the given order, the following values. 19,26,13,48,17 for each of
the three scenarios.
a) When collisions are handled by separate chaining. (7)
b) When collisions are handled by linear probing.
c) When collisions are handled by double hashing using second hash function h’=5- (5
mod k)
b) a) Get the hash index in table of size 7 for the following list. 56,43,27,32,3.
(7)
b) Briefly explain any 2 hashing functions.

*****************************************************

Page 3 of 3

You might also like