0% found this document useful (0 votes)
38 views

Greedy Algorithms: Algolab 8

The document provides instructions for three programming assignments involving greedy algorithms: 1) Implement Huffman coding using a min-heap priority queue to compress a message and measure compression. 2) Implement Kruskal's algorithm to find the minimum spanning tree of an edge-weighted graph. 3) Implement Prim's algorithm for finding a minimum spanning tree using both an array and a heap-based priority queue. Refer to CLRS for details on the implementation.

Uploaded by

Ayush Tibrewala
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views

Greedy Algorithms: Algolab 8

The document provides instructions for three programming assignments involving greedy algorithms: 1) Implement Huffman coding using a min-heap priority queue to compress a message and measure compression. 2) Implement Kruskal's algorithm to find the minimum spanning tree of an edge-weighted graph. 3) Implement Prim's algorithm for finding a minimum spanning tree using both an array and a heap-based priority queue. Refer to CLRS for details on the implementation.

Uploaded by

Ayush Tibrewala
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

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.

You might also like