You are on page 1of 6

Register Number

SATHYABAMA
INSTITUTE OF SCIENCE AND TECHNOLOGY
(Deemed to be University U/S 3 of UGC Act,1956)

Programme & Specialisation: B.E./B.TECH. - CSE/IT/ECE


Title of the Paper : Data Structures Max. Marks : 100
Course Code : SCSA1203 (2021) Time : 3 Hours
Date : 05-07-2022 Session : FN
________________________________________________________
(NOTE: Assume relevant data, if found missing) 

PART - A (10 × 2 = 20)


Answer ALL the Questions

1. Define ADT. (CO1)

2. Mention any two linear data structure. (CO1)

3. Assume the elements present in the list are 11, 45, 23, 67. Predict
the output of the following code (CO2)
snippet
int fun()
{
int x;
if(isEmpty())
return -1;
else
{
x = head->next->data;
return x;
}
}
4. Consider the given scenario (CO2)

Write the code to insert a new element temp in a singly linked


list.

5. Consider following scenario for representation of stack using


array - (CO3)

1. The five items : 11, 12, 13, 14 and 15 are inserted into stack
A one after other starting from 15 in reverse order.

2. The stack is popped three times and each element is inserted


into another stack B.

3. Then two elements are deleted from the stack B and pushed
back onto the stack A.

What are the topmost elements of stack A and Stack B


respectively?
6. If the sequence of operations. (CO3)
push(7)
push(5)
pop
push(6)
push(5)
pop
pop
pop
push(7)
pop
are performed on a stack, the sequence of popped out values are?

7. Perform the following operations one b one into an initially


empty circular queue (CO4)
(i) Enqueue 12

(ii) Enqueue 23

(iii) Enqueue 32

(iv) Enqueue 56

(v) Dequeue

(vi) Dequeue

(vii) Enqueue 68

(viii) Enqueue 82

(ix) Dequeue

Finally, identify the elements present in the circular queue.


8. Mention the purpose or output of the following code snippet
(CO4)
int fun()
{
int x;
if(isEmpty())
return -1;
else
{
x = q[front];
return x;
}
}

9. Provide a diagrammatic representation of sorting the given set of


numbers 42, 23, 74, 11, 65, 58, 94, 36, 99, 87 using two-way
merge sort algorithm. (CO5)

10. Mention the number of comparisons required for worst case and
best case time analysis involved in sorting a set of numbers using
bubble sort. (CO5)
PART - B (5 × 16 = 80)
Answer ALL the Questions
11. Write the tower of Hanoi algorithm. Illustrate a step-by-step
process involved in moving three disks. (CO1)
(or)
12. Write the factorial algorithm and derive the time analysis of the
algorithm. (CO1)

13. Write the algorithm for performing the following operations on a


singly linked list. (CO2)

(a) Insert (b) Delete


(or)
14. Write the algorithm for performing the following operations on a
doubly linked list. (CO2)
(a) Insert (b) Delete

15. (a) Show a step-by step illustration in converting the given infix
expression to the expression (A+B)*(C*D-E)*F/G. (CO3)

(b) Show a step-by step illustration in evaluating the postfix


expression 5 2 * 3 3 2 + * +
(or)
16. Write the algorithm for performing the following operations on a
stack. (CO3)
(a) push
(b) pop
(c) peep
(d) change

17. (a) Write the algorithm for performing the following operations
on a circular queue.

(i) insertion (ii) deletion (CO4)

(b) Write procedures fin adding a document to a printer job. The


documents are added to the queue in a circular manner.

For example:

Document 1: 10 pages
Document 2: 2 pages
Document 3: 1 pages
Document 4: 5 pages
At any point only are page in a document should be printed.
Repeat the proves until all the pages are printed.
(or)
18. Summarize in detail the insertion and deletion operations
performed on priority queue with neat sketch. (CO4)

19. Write quicksort algorithm and drive the worst case and best case
time analysis of quicksort algorithm. (CO5)
(or)
20. Write binary search algorithm and derive the worst case and
average case time analysis of binary search algorithm and
illustrate with an example. (CO5)

You might also like