Algorithms for updating Huffman codes

  • Authors:
  • Yasser El-Sonbaty;Nahla Belal

  • Affiliations:
  • College of Computing and Information Technology, Arab Academy for Science and Technology, Alexandria, Egypt;College of Computing and Information Technology, Arab Academy for Science and Technology, Alexandria, Egypt

  • Venue:
  • MATH'05 Proceedings of the 7th WSEAS International Conference on Applied Mathematics
  • Year:
  • 2005

Quantified Score

Hi-index 0.00

Visualization

Abstract

Given a list W = [w1,..., wn] of n positive symbol weights, and a list L = [l1,.....,ln] of n corresponding integer codeword lengths, it is required to find the new list L when a new value x is inserted in or when an existing value is deleted from the list of weights W. The presented algorithm uses the given information about the weights and their corresponding levels in order to perform the required update. No other knowledge about the original Huffman Tree is assumed to be known. Instead of rebuilding the Huffman Tree, the new algorithm redistributes the weights among the levels to obtain the new Huffman Code. In many special cases, the updated Huffman Code can be generated with lower complexity than reconstructing the Huffman Tree from scratch by efficiently using the information of weights and their levels. In this paper, we present an updating algorithm that requires a linear complexity in many practical cases rather than the O(n log n) needed for reconstructing the Huffman Tree. We also give practical O(n log n) implementations for our algorithms.