Docsity

CMPSC 465, Spring 2009 Homework 9: Algorithms and Data Structures, Assignments of Computer Science

Toggle sidebar
bg1
CMPSC 465, Spring 2009, Homework 9
Due: Saturday,April 18, 1 pm. slide under the door of IST 346H, between 7 pm Friday
and 1 pm Saturday theywill be box in front of IST 337.
Problem 1.
a) Explain howPictures for Prim’sAlgorithm illustrate the algorithm. What are the
edge costs? What is the meaning of the colors of edges? What is the meaning of
red and blue numbers?
b) Use printouts of the third page of that file to illustrate howKruskal’salgorithm runs.
b) Use printouts of the third page of that file to illustrate howDisjksta’salgorithm runs.
Problem 2. Your task is to compress a text in which each symbol is random, 0 or 1, but
1’soccur with probability that is twice larger.Makean‘‘alphabet’’ofstrings of length 3
and provide Huffman code. Howmuch shorter will the code be compared with the text,
on the average?
Exercise 6, page 333.
Exercise 2, page 362.

Partial preview of the text

Download CMPSC 465, Spring 2009 Homework 9: Algorithms and Data Structures and more Assignments Computer Science in PDF only on Docsity!

CMPSC 465, Spring 2009, Homework 9

Due: Saturday, April 18, 1 pm. slide under the door of IST 346H, between 7 pm Friday and 1 pm Saturday they will be box in front of IST 337.

Problem 1.

a) Explain how Pictures for Prim’s Algorithm illustrate the algorithm. What are the edge costs? What is the meaning of the colors of edges? What is the meaning of red and blue numbers?

b) Use printouts of the third page of that file to illustrate how Kruskal’s algorithm runs.

b) Use printouts of the third page of that file to illustrate how Disjksta’s algorithm runs.

Problem 2. Your task is to compress a text in which each symbol is random, 0 or 1, but 1’s occur with probability that is twice larger. Make an ‘‘alphabet’’ of strings of length 3 and provide Huffman code. How much shorter will the code be compared with the text, on the average?

Exercise 6, page 333.

Exercise 2, page 362.