huffman

  • Daten komprimieren mit Köpfchen (Teil 2) – Huffman-Code in Python umsetzen

    Compressing Data with Smart (Part 2) – Converting Huffman Code in Python

    In the first part, the example of KAFFEPAUSE was shown how the Huffman algorithm uses character frequency to create a binary tree and extract space-saving, unique codes from it. The basics are explained in detail in Teil 1 on ffritze.de.

    In this second part, the Huffman algorithm is implemented in Python and gradually traced in a Jupyter Notebook. The focus is not only on the finished program. The individual data structures and processing steps are made visible so that the construction of the Huffman tree and the generation of the codes can be tried out directly.

    (more…)
  • Daten komprimieren mit Köpfchen (Teil 1) – Der Huffman-Algorithmus einfach erklärt

    Compressing Data with Smarts (Part 1) – The Huffman Algorithm Explained Simply

    Conventional computer codes give each letter the same storage space - the common 'E' consumes as much as the rare 'K'.

    The Huffman algorithm chooses a smarter way: frequent characters get very short codes, rare a little longer. Thus, the amount of data shrinks without any loss of information.

    How to create an elegant Huffman tree from character frequencies step by step, let's look directly at the example word: KAFFEPAUSE.

    (more…)