# Review: Implementation of The Dynamic Huffman Coding Implemented by Vitter (Book Review Sample)

The task was about reviewing an implementation of the dynamic Huffman coding implemented by vitter. Also comparing the implementation with the way it could work in c++ WAS REQUIRED.

source..Task C

This paper discusses a detailed implementation of one pass dynamic Huffman coding algorithm using pascal. It goes ahead and shows clearly the comparison of pascal and C++ in terms of implementation bringing out clear details of which language is better in terms of speed, memory management and real time capabilities. The most important area of application of this algorithm is in file compression and in network transmission.

In the implementation process, the following notation are used. n = alphabet letter, (Bedruz, 2006) aj which stands for jth letter in the alphabet, t which is the number of letters in the message processing and k which is the number of processed letters in the so far. Its worth noting that the implementation is supposed to achieve real time capability, this is because the processing time of each letter will be directly proportional to the length of its encoding. Each letter k in the message is encoded from the root to the leaf node in a binary tree known as Huffman tree.

Several data structures are used in the implementation of this algorithm in pascal. These are: All the leaves of a given weight are denoted as leaf blocks while are internal nodes of a given block as internal blocks. The blocks are linked together in increasing order in terms of weight and a leaf always precedes an internal block. The data structure used for the implementation must support the following operations. The data structure must be able to a binary Huffman tree with minimal weights, it must be in a position to store a contiguous list of internal tree nodes in nondecreasing order of the weight. Interchange the two leaves with the same weight in the tree and increment the weight of the leader block by 1.

To represent the binary tree several arrays of integers are used this are weight[b], parent [b], parity[b] and child[b] , first [b] , last [b], previous Block[b] and next Block[b] . Each slot of the array must have a capability to store any integer in the weight whose range is [0,t] . The avail block is the first block in the available list which can have 0 value or non-empty. The final component of the data structures used is a stack . Having understood the data structures employed in implementation, the following steps can be followed to implement the algorithm in pascal.

The first step is creation of a loop that will encode and transmit a message. This involves initializing a loop, while there are more letters to encode in the message, let aj be the next letter to encode, encode and transmit I then update j to be the next l