Sunteți pe pagina 1din 4

Name :

htt
Roll No. : ....
Invigilators Signature : ..
CS/M.Tech (CSE)/SEM-1/MCS-102/2011-12
p:/
2011
DATA STRUCTURES & ALGORITHM
Time Allotted : 3 Hours Full Marks : 70
/q
The figures in the margin indicate full marks.
Candidates are required to give their answers in their own words
pap
as far as practicable.

Answer any five of the following. 5 14 = 70


er.

1. Write an algorithm for graph colouring problem using

backtracking and find an upper bound on its time


wb

complexity. Give 4 colours, find all possible colour

assignments pertaining to proper colouring. 5+4+5


ut .
a c.
in

40205 [ Turn over


CS/M.Tech (CSE)/SEM-1/MCS-102/2011-12

2. a) Define P, NP, NP-hard, NP-complete set of problems and


htt
show the relationship between them. 3

b) Show that Clique decision problem is NP-complete. 5


p:/
c) Explain approximation algorithm with an example. 6

3. Write algorithms to implement the following :


/q
a) Reversal of linear linked list. 6

b) Insertion and deletion in a doubly linked list. 8


pap

4. Write down Bellman Ford algorithm. Find the shortest path


from source vertex s to the rest of the vertices for the graph
shown in figure using the same. 7+7
er.
wb
ut .

Figure

5. a) What is sparse matrix ? How will you represent lower


triangular matrix in memory using row major order and
a c.

column major order. 2+6

b) Analysis the average case time complexity of quick


in

sort. 6

40205 2
CS/M.Tech (CSE)/SEM-1/MCS-102/2011-12

6. a) Analysis the time and space complexity of algorithm


htt
given below. 5

b) Solve the recurrence T (n ) = T (n / 2) + T (n / 4) + T (n / 8) + n


p:/
using iterative method. 3
!
c) Show that 2n 2n + nlogn = " n 2 2n .
2
( ) 3
/q

3 4
d) Show that #
k=0 to n k = " n . ( ) 3
pap
!
Algorithm Transpose (a,n)
{
for! i=1 to n1 do
for j=i+1 to n do
{
er.

temp=a[i,j];
a[i,j]=a[j,i];
a[j,i]=temp;
wb

}
}

7. a) What is tail recursion ? Explain with an example. 3


ut .

b) Justify the statement : For every recursive algorithm

there exists an iterative version. 5


a c.

c) Create an AVL tree for the following list of elements.

< 5, 4, 3, 2, 1, 6, 7, 8, 9, 10 > 6
in

40205 3 [ Turn over


CS/M.Tech (CSE)/SEM-1/MCS-102/2011-12

8. a) What is threaded binary tree ? Explain. 4


htt
b) Write a non-recursive algorithm to implement inorder

traversal of binary tree. 4


p:/
c) What is red-black tree ? Create a red-black tree for the
/q
following list of elements < 10, 8, 6, 4, 2, 1, 3, 5, 7, 9 >

6
pap
er.
wb
ut .
a c.
in

40205 4

S-ar putea să vă placă și