Basic Data Structure and Algorithms Koe045
Basic Data Structure and Algorithms Koe045
BTECH
(SEM IV) THEORY EXAMINATION 2021-22
BASIC DATA STRUCTURE AND ALGORITHMS
SECTION A
1. Attempt all questions in brief. 2x10 = 20
Qno Questions CO
(a) Determine the worst-case time complexity of inserting n elements into an 1
empty linked list, if the linked list needs to be maintained in sorted order?
(b) What do you understand by time complexity of algorithm? Explain BIG Oh 1
notation with bubble sort example.
(c) Find out number of items in following cases. 2
i. top=5, size=10 (Stack)
ii. rear=5, front=2, size=10 (Queue)
iii. rear=2, front=5, size=10 (Circular Queue)
(d) Compute the result evaluating the postfix expression 15 5 + 12 5 / * 5 - 2
is_____.
(e) Illustrate when a sorting technique is called stable? 3
(f) Consider the array A = <14, 11, 13, 12, 6, 9, 10, 12, 8, 7>. After building 3
heap from the array A, determine the depth of the heap and the right child of
max-heap. (Root is at level 0).
90
2
13
(g) The post order traversal of a binary tree is 8,9,6,7,4,5,2,3,1. The in order 4
_2
traversal of the same tree is 8,6,9,4,7,2,5,1,3. The height of a tree is the length
2.
of the longest path from the root to any leaf.
P2
24
Predict the height of the binary tree is_________.
2E
(h) The following numbers are inserted into an empty binary search tree in the 4
5.
given order: 11, 6, 3, 5, 15, 12, 16. Calculate the height of the binary search
.5
P2
tree (the height is the maximum distance of a leaf node from the root)?
17
(i) Differentiate between Graph and tree. 5
Q
|1
SECTION B
4
0:
(a) What do you mean by linked list? Discuss structure of all possible types of 1
linked list.
2
(b) Describe tail recursion and non-tail recursion with suitable example. Also 2
02
(d) Use Heap sort algorithm to sort the given array and write all the steps: 82, 5
4-
SECTION C
3. Attempt any one part of the following: 10x1 = 10
Qno Questions CO
(a) Write structure of linked list that can be used to represent a polynomial of the 1
following type 4x4 y4-9x3 y2+6x2-y+8. Write an algorithm to find addition
of two polynomials
(b) What is Sparse matrix? Explain how a Sparse matrix can be implemented by 1
using the linked list?
BTECH
(SEM IV) THEORY EXAMINATION 2021-22
BASIC DATA STRUCTURE AND ALGORITHMS
2
13
6. Attempt any one part of the following: 10x1 = 10
_2
Qno Questions CO
2.
P2
(a) Apply Kruskal’s and Prism’s algorithm to find the minimum spanning tree in 4
24
the following given graph.
2E
5.
.5
P2
17
Q
|1
4 0
0:
:3
13
2
02
-2
(a) Write quick sort algorithm and its analysis. Use Quick sort algorithm to sort 5
9, 11, 10, 1, 60, 10, 6, 25, 40, and 30. Is it a stable sorting algorithm? Justify.
(b) Write merge sort algorithm and its analysis. Use merge sort algorithm to sort 5
9, 11, 10, 1, 60, 10, 6, 25, 40, and 30. Is it a stable sorting algorithm? Justify.: