Greedy Algorithms: Algolab 8
Greedy Algorithms: Algolab 8
Lab 6
1. Write a program for Human Coding using priority queues implemented as min-heap.
Suppose that we have an alphabet of n symbols and a long message consisting of symbols
from this alphabet. We wish to encode the message as a long bit string ( a bit is either
0 or 1 ) by assigning a bit string code to each symbol of the alphabet and concatenating
individual codes of the symbols making up the message to produce an encoding of the
message. Create a message is a page long how much compression is obtained by doing
Human coding?
2. Write a program to implement Kruskals algorithms for nding the minimum spanning
tree of a given edge-weighted graph .
3. Write a program to implement Prims algorithm using (a) an array (b) a heap for the
priority queue. Refer to CLRS and understand how it can be implemented.