Computer Science (Semester 3)
Total marks: 80
Total time: 3 Hours
INSTRUCTIONS
(1) Question 1 is compulsory.
(2) Attempt any three from the remaining questions.
(3) Draw neat diagrams wherever necessary.
PART - A
1.a.
What is linked list? Write advantages of doubly linked list over singly linked list.
(2 marks)
00
1.b.
What is recursion? Give the properties of a recursive definition of an algorithm.
(3 marks)
00
1.c.
What is a stack? List the, applications of stack.
(2 marks)
00
1.d.
Show the detailed contents of stack to evaluate the given postfix expression.
{1 2 3 + * 3 2 1 - + * }
(3 marks)
00
1.e.
Define a graph. List different graph traversal techniques.
(2 marks)
00
1.f.
What are binary trees? Mention different types of binary trees with example.
(3 marks)
00
1.g.
TYPE_QUESTION_HERE
(2 marks)
00
1.h.
What is sorting? What is searching?
(3 marks)
00
1.i.
Define AVL tree? Give example.
(2 marks)
00
1.j.
What is $\mathrm{B}$ -tree of order $\mathrm{m}$ ? Draw a B-tree of order 3
(3 marks)
00
PART - B
2.a.
What is amortized complexity? Explain different method's to arrive at amortized costs for operations.
(5 marks)
00
2.b.
Write a C program to implement insertion to the immediate left of the Kth node in singly linked list.
(5 marks)
00
OR
3.a.
Given an' ordered linked list whose node is represented by "key" as information and "next" as link field.Write a C program to implement deleting number of nodes ( consecutive) whose 'key' values are greater than or equal to 'Kmin' and less than 'Kmax'
(10 marks)
00
4.a.
Write a C program to implement multiple stacks using single array.
(5 marks)
00
4.b.
Convert the infix expression a / b - c + d * e - a * c into postfix expression and trace that postfix expression for given data a = 6 , b = 3 , c = 1 , d = 2 , e = 4
(5 marks)
00
OR
5.a.
What is a circular queue? Implement insert and delete operations.
(10 marks)
00
6.a.
Construct a binary tree having the following traversal sequences:
Preorder traversal A B C D E F G H I
Inorder traversal B C A E D G H F I
(5 marks)
00
6.b.
Implement Depth First Search (DFS) algorithm.
(5 marks)
00
OR
7.a.
Define a Max Heap. Construct a max heap for the following:
$\{12,15 ; 9,8,10,18,7,20 ; 25\}$
(5 marks)
00
7.b.
What is a graph? Explain various representations of graphs.
(5 marks)
00
8.a.
Write an algorithm for Heap sort.
(5 marks)
00
8.b.
Apply selection sort on the following elements:
{21,11,5,78,49,54,72,88}
(5 marks)
00
OR
9.a.
What is collision? Explain different collision resolution techniques with examples
(10 marks)
00
10.a.
Build an AVL tree with the following values.
$\{15,20,24,10,13,7,30,36,25,42,29\}$
(5 marks)
00
10.b.
Write Knuth Morris Pratt pattern matching algorithm.
(5 marks)
00
OR
11.a.
Write short notes on:
a) Red-Black trees
b) splay trees
c) b-trees.
(10 marks)
00