Dsecl Zg519-Ec3m PDF
Dsecl Zg519-Ec3m PDF
Dsecl Zg519-Ec3m PDF
Fig-1
a) What is the morse code for the test ‘EOD’ based on the given tree?
b) What is the text for the morse code ‘●–● ●●– –●’
Q.4. Consider a hash table created for storing integers. The initial size of the hash table is 5.
The hash function used is integer value (X) mod the size(N) of the hash table . H(X)=
X Mod N. When the load factor reaches or exceeds 0.5, the table enlarges to double
capacity and rehashes values stored at smaller indices first. Insert the following
elements in order. 86, 76, 16, 66, 26
a) What are the indices of the elements 86, 76, 16, 66, 26 in the final hash set?
Indices start from 0.
b) What is the load factor of the final hash set?
Q.5. Construct a Binary Search tree for the following keys 13, 3, 4, 12, 14, 10, 5, 1,8, 2, 7,
9, 11, 6, 18 in that order.
Q.6. Consider a complete undirected graph with vertex set {A,B,C,D,E} entry w[i,j] in the
matrix w below is the weight of the edge {i,j} as per the Table-1
A B C D E
A 0 35 40 ∞ ∞
B 35 0 25 10 ∞
C 40 25 0 20 15
D ∞ 10 20 0 30
E 0 0 15 30 0
Table-1
a) Construct the minimum spanning tree using kruskal’s algorithm and
b) Calculate the total cost of the minimum spanning tree
Q.7. Suppose you woke up on some mysterious island and there are different precious items
on it. Each item has a different value and weight. You are also provided with a bag to
take some of the items along with you but your bag has a limitation of the maximum
weight you can put in it. So, you need to choose items to put in your bag such that the
overall value of items in your bag maximizes. The only condition of the island is none
of the items cannot be broken. There are different kinds of items (i =4) and each
item i has a weight (wi) and value (vi) associated with it. xi is the number of i kind of
items we have picked. And the bag has a limitation of maximum weight (W =8).
Q.8. Imagine you have a 20 GB file with one string per line. Explain how you would sort the
file.
Q.9. Let A1,A2,A3, and A4 be four matrices of dimension 30 × 1, 1 × 40, 40 × 10, 10 × 25,
respectively. Parenthesize the matrix to minimize the number of scalar multiplications
required and cost of multiplying the given matrix