Question: Problem 1 Construct the Huffman code ( i . e , the optimum prefix code ) for the alphabet { a , b , c
Problem Construct the Huffman code ie the optimum prefix code for the alphabet
a b c d e f g with the following frequencies:
Symbols a b c d e f g
Frequencies
Also give the weighted length of the code ie the sum over all symbols the frequency
of the symbol times its encoding length
Problem We are given an array A of length n For every integer i in n
let bi be median of the subarray AiIf the subarray has even length, its the median
is defined as the lower of the two medians. That is if i is even, bi is the ith smallest
number in Ai The goal of the problem is to output b b b bn in On log n
time.
For example, if n and A Then b
b b b b b b b b b
Hint: use the heap data structure.
Problem In the interval covering problem, we are given n intervals s ts t
sn tn such that S
i in nsi ti T The goal of the problem is to return a
smallestsize set S n such that S
i in S si ti T
Figure : An instance of the interval covering problem.
Your Group Id
For example, in the instance given by Figure The intervals are
Then we can use intervals indexed by
to cover the interval This is optimum since no two intervals can cover
Design a greedy algorithm to solve the problem. it suffices for your algorithm to run
in polynomial time. To prove the correctness of the algorithm, it is recommended that
you can follow the following steps:
Design a simple strategy to make a decision for one step.
Prove that the decision is safe.
Describe the reduced instance after you made the decision.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
