this post was submitted on 21 Jan 2024
45 points (95.9% liked)

Programming

22218 readers
363 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 2 years ago
MODERATORS
top 5 comments
sorted by: hot top controversial new old
[–] sus@programming.dev 56 points 2 years ago (2 children)

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

[–] Solemarc@lemmy.world 15 points 2 years 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!

[–] altec@midwest.social 14 points 2 years ago (1 children)

Then we could make a language where the letters are equivalent to the number of As

[–] Deebster@programming.dev 13 points 2 years 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 29 points 2 years ago* (last edited 2 years 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!