Professional Documents
Culture Documents
SATHYABAMA
INSTITUTE OF SCIENCE AND TECHNOLOGY
(Deemed to be University U/S 3 of UGC Act,1956)
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)
1. The five items : 11, 12, 13, 14 and 15 are inserted into stack
A one after other starting from 15 in reverse order.
3. Then two elements are deleted from the stack B and pushed
back onto the stack A.
(ii) Enqueue 23
(iii) Enqueue 32
(iv) Enqueue 56
(v) Dequeue
(vi) Dequeue
(vii) Enqueue 68
(viii) Enqueue 82
(ix) Dequeue
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)
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)
17. (a) Write the algorithm for performing the following operations
on a circular queue.
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)