0% found this document useful (0 votes)
29 views2 pages

B.Tech/: B.Pharm. Put Odd Semester 2023-24

data structure

Uploaded by

Aamina Khatoon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views2 pages

B.Tech/: B.Pharm. Put Odd Semester 2023-24

data structure

Uploaded by

Aamina Khatoon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

SUBJECT CODE: ROLL NO.

----------------------------
c) Write advantages and disadvantages of linked list over arrays. Write a 'C'
BRANCH: YEAR: Final /Third function creating new linear linked list by selecting alternate elements of a
linear linked list.
d) Write algorithms of insertion sort. Implement the same on the following
B.TECH/ B.Pharm. numbers; also calculate its time complexity. 13, 16, 10, 11, 4, 12, 6, 7
e) Differentiate between DFS and BFS. Draw the breadth First Tree for the
PUT ODD SEMESTER 2023-24 given graph.
Time: 2 Hours [Total Marks: 100]

Section-A
Q.1. Attempt all questions in brief. (2*10=20)

a) Define a sparse matrix. Suggest a space efficient representation for space


matrices. Section-C
b) List the advantages of doubly linked list over single linked list.
c) Give example of one each stable and unstable sorting techniques. Q.3. Attempt any one part of the following: (10*1=10)
d) Write advantages of AVL tree over Binary Search Tree (BST) a) Suppose a three dimensional array A is declared using A[1:10, -5:5, -
e) What is tail recursion? Explain with a suitable example.
10:5)
f) Write different representations of graphs in the memory.
g) Convert the infix expression (A+B) *(C-D) $E*F to postfix. Give the answer
(i) Find the length of each dimension and the number of elements in A
without any spaces. (ii) Explain Row major order and Column Major Order in detail with
h) Rank the following typical bounds in increasing order of growth rate: explanation formula expression.
O(log n), O(n4), O(1), O(n2 log n) b) Discuss the representation of polynomial of single variable using
i) Draw the binary search tree that results from inserting the following linked list. Write 'C' functions to add two such polynomials
numbers in sequence starting with 11: 11, 47, 81, 9, 61, 10, 12, represented by linked list.
j) What does the following recursive function do for a given Linked List with
first node as head? Q.4. Attempt any one part of the following: (10*1=10)
void fun1(struct node* head) a) (i) Use the merge sort algorithm to sort the following elements in
{ ascending order. 13, 16, 10, 11, 4, 12, 6, 7.
if(head == NULL)
What is the time and space complexity of merge sort?
return;
fun1(head->next);
(ii)Use quick sort algorithm to sort 15,22,30,10,15,64,1,3,9,2. Is it a
printf("%d ", head->data); stable sorting algorithm? Justify.
} b) (i) The keys 12, 17, 13, 2, 5, 43, 5 and 15 are inserted into an initially
Section-B empty hash table of length 15 using open addressing with hash
Q.2. Attempt any Two questions from this section. (15*2=30) function h(k) = k mod 10 and linear probing. What is the resultant
a) Differentiate between linear and binary search algorithm. Write a recursive hash table?
function to implement binary search. (ii) Differentiae between linear and quadratic probing techniques.
b) What is the significance of maintaining threads in Binary Search Tree?
Write an algorithm to insert a node in thread binary tree. Q.5. Attempt any one part of the following: (10*1=10)
a) Use Dijkstra’s algorithm to find the shortest paths from source to all
other vertices in the following graph.

b) Apply Prim’s algorithm to find a minimum spanning tree in the


following weighted graph as shown below.

Q.6. Attempt any one part of the following: (10*1=10)


a) (i) Write an iterative function to search a key in Binary Search Tree
(BST).
(ii) Discuss disadvantages of recursion with some suitable example.
b) (i) What is Recursion?
(ii)Write a C program to calculate factorial of number using recursive
and non- recursive functions.

Q.7. Attempt any one part of the following: (10*1=10)


a) (i) Why does time complexity of search operation in B-Tree is better
than Binary Search Tree (BST)?
(ii) Insert the following keys into an initially empty B-tree of order 5
a, g, f, b, k, d, h, m, j, e, s, i, r, x, c, l, n, t, u, p
(iii) What will be the resultant B-Tree after deleting keys j, t and d in
sequence?
b) (i) Design a method for keeping two stacks within a single linear
array so that neither stack overflow until all the memory is used.
(ii) Write a C program to reverse a string using stack.

You might also like