Exact and Experimental Algorithms for a Huffman-Based Error Detecting Code

  • Paulo Eustáquio Duarte Pinto
  • Fábio Protti
  • Jayme Luiz Szwarcfiter
Part of the Lecture Notes in Computer Science book series (LNCS, volume 5532)


Even codes are Huffman based codes in which every encoding contains an even number of 1’s, thus having the ability of detecting the occurrence of an odd number of 1-bit errors in the message. The motivation for defining such codes comes from a problem posed by Hamming in 1980. Even codes have been studied for the case in which symbols have uniform probabilities. In this work, we consider the general situation of arbitrary probabilities. An exact algorithm for constructing an optimal even code is described with complexity O(n 3), where n is the number of symbols. Further, two heuristics for constructing nearly optimal even codes are presented, both requiring O(n logn) time. The cost of the even code constructed by the second heuristics is at most 16,7% higher than the cost of a Huffman code, for the same probabilities. However, computational experiments suggest that, for practical purposes, this value seems to be better: about 5% or less, for n large enough. This corresponds to the amount of redundancy to be added to the message in order to keep the ability of error detection. Concerning undetected errors, we obtain bounds on the probability of producing k consecutive erroneous symbols, suggesting that such a probability is small for large messages.


Data compression error detection even codes Huffman codes Hamming codes 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Huffman, D.A.: A Method for the Construction of Minimum Redundancy Codes. In: Proceedings of the IRE, vol. 40, pp. 1098–1101 (1951)Google Scholar
  2. 2.
    Faller, N.: An adaptative Method for Data Compression. In: Record of the 7th Asilomar Conference on Circuits, Systems and Computers, Naval Postgraduate School, Monterrey, Ca, pp. 593–597 (1973)Google Scholar
  3. 3.
    Gallager, R.G.: Variations on a Theme by Huffman. IEEE Transactions on Information Theory 24, 668–674 (1978)zbMATHCrossRefMathSciNetGoogle Scholar
  4. 4.
    Knuth, D.E.: Dynamic Huffman Coding. Journal of Algorithms 6, 163–180 (1985)zbMATHCrossRefMathSciNetGoogle Scholar
  5. 5.
    Milidiú, R.L., Laber, E.S., Pessoa, A.A.: Improved Analysis of the FGK Algorithm. Journal of Algorithms 28, 195–211 (1999)CrossRefGoogle Scholar
  6. 6.
    Schwartz, E.S.: An Optimum Encoding with Minimal Longest Code and Total Number of Digits. Information and Control 7, 37–44 (1964)zbMATHCrossRefMathSciNetGoogle Scholar
  7. 7.
    Turpin, A., Moffat, A.: Practical length-limited coding for large alphabeths. Computer J. 38(5), 339–347 (1995)CrossRefGoogle Scholar
  8. 8.
    Larmore, L.L., Hirshberg, D.S.: A fast algorithm for optimal length-limited Huffman codes. J. ACM 37(3), 464–473 (1990)zbMATHCrossRefGoogle Scholar
  9. 9.
    Milidiú, R.L., Laber, E.S.: The Warm-up Algorithm: A Lagrangean Construction of Length Restricted Huffman Codes. SIAM Journal on Computing 30(5), 1405–1426 (2000)zbMATHCrossRefMathSciNetGoogle Scholar
  10. 10.
    Milidiú, R.L., Laber, E.S.: Improved Bounds on the Ineficiency of Length Restricted Codes. Algorithmica 31(4), 513–529 (2001)zbMATHCrossRefMathSciNetGoogle Scholar
  11. 11.
    Hamming, R.W.: Coding And Information Theory. Prentice Hall, Englewood Cliffs (1980)zbMATHGoogle Scholar
  12. 12.
    Pinto, P.E.D., Protti, F., Szwarcfiter, J.L.: Parity codes. RAIRO - Inf. Theor. Appl. 39, 263–278 (2005)zbMATHCrossRefMathSciNetGoogle Scholar
  13. 13.
    Pinto, P.E.D., Protti, F., Szwarcfiter, J.L.: A Huffman-based Error detecting Code. In: Ribeiro, C.C., Martins, S.L. (eds.) WEA 2004. LNCS, vol. 3059, pp. 446–457. Springer, Heidelberg (2004)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2009

Authors and Affiliations

  • Paulo Eustáquio Duarte Pinto
    • 1
  • Fábio Protti
    • 2
  • Jayme Luiz Szwarcfiter
    • 3
  1. 1.Instituto de Matemática e EstatisticaUniversidade Estadual do Rio de JaneiroBrasil
  2. 2.Instituto de MatemáticaUniversidade Federal do Rio de Janeiro Caixa Postal 68.530Brasil
  3. 3.Instituto de Matemática, Núcleo de Computação Eletrônica and COPPE-SistemasUniversidade Federal do Rio de Janeiro Caixa Postal 68511Brasil

Personalised recommendations