

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Question: Is your friends’ greedy algorithm optimal, in the sense that it finds a valid set whose size is as small as possible? Give the correctness of the above greedy algorithm or show an example, in which the algorithm gives a solution with more points than the optimum contains.
1
(a) Give an efficient algorithm to test if T remains the minimum-cost spanning tree with the new edge added to G (but not to T ). Make your algorithm run in time O(|E|). Can you do it in O(|V |) time? Please mention what data structure are you assuming for representing the graph G and the tree T. (b) Suppose T is no longer the minimum-cost spanning tree. Give a O(|E|-time algorithm to update the tree T to the new minimum spanning tree.
(a) Prove that in the Huffman coding algorithm if some character occurs with frequency greater than 2 5 ,^ there exists a codeword of length one.^ Also prove that if all charactes occur with frequency less than 13 then, there is no codeword of length one. (Assume that all frequencies add up to 1.) (b) Codex Unlimited manufactures hardware to decode Huffman-encoded game files in an XBox when you play them over a network. Its decoding hardware stores an entire codeword in a register when it is looking for a match. The uncompressed game files contain characters from an alphabet of size n. What is the minimum required register width ( number of bits) that can support all Huffman codes for n characters, no matter what the frequencies f 1 , f 2 ,... , fn are? What relationship between the frequencies f 1 , f 2 ,... , fn causes the worst case (longest codeword) to occur?