Assignment 3

Instructions to Solve Assignments

The purpose of the assignments is to give students hands on practice. It is expected that students will solve assignments themselves. The Following rules that will apply during the evaluation of the assignment.

Cheating from any source will result in zero marks in the assignment.

Any student found cheating in any two of the assignments submitted during the course will

be awarded “F” grade in the course.

No assignment after the due date will be accepted.

Fall 2019

Answer the following questions in your own words. Plagiarism will be checked for each question. Marks will be awarded on the basis of the answer and plagiarism report.

Question 1 (30 Marks)

Determine the cost and structure of an optimal binary search tree (OBST) for a set of n = 5 keys with the probabilities given below. You need to calculate the tables e[i, j], w[i, j] and root[i, j].

Fall 2019

i | 0 | 1 | 2 | 3 | 4 | 5 |
---|---|---|---|---|---|---|

pi | 0.15 | 0.10 | 0.05 | 0.10 | 0.20 | |

qi | 0.05 | 0.05 | 0.05 | 0.10 | 0.05 | 0.10 |

Question 2

What is an optimal Huffman Code for the following set of frequencies? a:25 b:11 c:37 d:5 e:43 f:12 g:19 h:31

(20 Marks)

]]>Determine the cost and structure of an optimal binary search tree (OBST) for a set of n = 5 keys with the probabilities given below. You need to calculate the tables e[i, j], w[i, j] and root[i, j].