Uploaded by Mr. Omesh Wadhwani

ADVANCE DATA STRUCTURES

advertisement
Course Code : ITT 354-1
GHXW/MW – 22 / 1675
Fifth Semester B. Tech. ( Information Technology ) Examination
ADVANCE DATA STRUCTURES
Time : 3 Hours ]
[ Max. Marks : 60
Instructions to Candidates :—
1.
(1)
All questions are compulsory.
(2)
Assume suitable data wherever required and mention it.
(a)
(b)
(c)
Find time complexity for the given code :
(i)
while (m! = n)
{
if (m > n)
m=m–n;
else
n=n–m;
}
(ii)
a=1
while (a < b)
{
strut ;
a=a*2;
}
Prove that running Time T(n) = n4 + 7n + 3 is Ω(n3).
(i)
4(CO1)
3(CO1)
Find While loop equivalence for the given code :
For (i = 1 ; i < n ; i = i * 2)
{
Statements( ) ;
}
GHXW/MW-22 / 1675
Contd.
(ii)
Find for loop equivalence for the given code :
i=1;
k=1;
while (k < n)
{
strut ;
k=k+i;
i++ ;
}
2.
(a)
3(CO1)
Write a program to delete duplicate nodes in doubly linked list.
OR
Write a program to search an element in a doubly linked list.
(b)
5(CO2)
(i)
Is this BST balanced or not ?
(ii)
Construct a Binary Search Tree (BST) for the following sequence
of numbers —
50, 15, 62, 5, 20, 58, 91, 3, 8, 37, 60, 24
How to find cousin nodes in above tree ? Write function for
it.
1+4(CO2)
3.
(a)
Delete following nodes 2, 8, 6, 5, 17 from the given AVL tree. Show
step by step execution.
5(CO3)
GHXW/MW-22 / 1675
2
Contd.
(b)
Create Red Black tree items : 4, 2, 6, 7, 11, 3, 8, 21, 9.
Note : label 'B' and 'R' respectively for Black and Red colour nodes.
5(CO3)
4.
5.
(a)
What do you mean by collision in terms of hashing ? Which are the
methods for handling them ? Explain with proper example.
5(CO4)
(b)
Consider a hash table of size eight, with starting index zero, and a hash
function (2x + 3) mod 7. Assuming the hash table is initially empty. Show
the contents of the table when the sequence 2, 5, 7, 8, 9, 10, 3, 12, 14
is inserted into the table using closed hashing.
5(CO4)
(a)
Find Longest Common Sequence for the following strings. What is the application
of it ?
X = DABBDAABCCBBDABB, Y = BDABA
(b)
6.
(a)
5(CO5)
Create Huffman tree, for given frequencies, and encode the Message :
DCABBDDAECBBAEDAADCC. How to decode it ?
A
4
B
6
C
7
D
3
E
2
5(CO5)
Write Algorithm of searching operation for skip list. Show flow of searching
number 16 in the given skip list.
5(CO6)
GHXW/MW-22 / 1675
3
Contd.
(b)
Write Algorithm / pseudo code of deletion operation for skip list. Explain
this operation for given skip list for deleting elements 9 and 22.
5(CO6)
D
GHXW/MW-22 / 1675
4
15
Download