Assignment
Assignment
ASSIGNMENT
Due: Nov 13th, 2014. 10:05 AM
1.
T (n) = 4T ( n3 ) + n2
b. (2 marks)
T (n) = 3T ( n2 ) + n3
2.
(4 marks) Doubly Linked Lists can be implemented using one pointer instead of two.
This can be achieved by a specific binary operation on two pointers next and previous,
assuming pointers can be interpreted as k-bit integers. Assume that you have (access to)
head and tail pointers. Using this particular representation,
a. (3 marks)
b. (1 mark )
3.
a. (3 marks)
As an auxiliary algorithm for merge sort, we have seen how two
sorted arrays/lists can be merged into a single sorted array/list. Give an algorithm of
time complexity of O(n lg k) to merge k-arrays/lists which are sorted into a single sorted
array/list. Here n is total number of elements.
b. (1 mark )
What is the optimal Huffman code for the following set A =
{a, b, c, d, e, f, g} if the frequencies are given by F = {1, 1, 2, 3, 5, 8, 13} i.e. first seven
Fibonacci numbers. Can you generalise the answer for the case when the frequencies are
first n Fibonacci numbers?
4.
a. (2 marks)
An AVL tree is constructed for the input set A = {1, 2, 3, 4, 5} in
some order specified by the permutations of the set A. Find the permutations for which
there is no need to do any rotations at any stage during insertions.
b. (1 mark )
c. (1 mark )
5.
A connected graph where a least cost edge is not part of any minimum