• sus@programming.dev
    link
    fedilink
    arrow-up
    56
    ·
    11 months ago

    To save even more data, replace every symbol with A. Then just store the amount of As.

    • Solemarc@lemmy.world
      link
      fedilink
      arrow-up
      15
      ·
      11 months ago

      Would it be better to use A’s and B’s? We could half the necessary length of a symbol by assigning a certain combination of A’s and B’s to a symbol. And if characters take up too much space we could use 1’s and 0’s instead!

      • Deebster@programming.dev
        link
        fedilink
        arrow-up
        13
        ·
        11 months ago

        To save sending the tree every time, we could just have a fixed layout of letters and symbols. This would have the advantage that we could put them in order, which would be easier to work with.

  • xmunk@sh.itjust.works
    link
    fedilink
    arrow-up
    29
    ·
    edit-2
    11 months ago

    Before I opened this article I thought “I bet they just learned what Huffman Encoding is” and I stand my hypothesis. It’s an extremely fun compression algorithm as it’s very trivial to comprehend and reason about… it’s straightforward enough you can write it yourself!