> [!tldr] A conceptually simple algorithm for compressing data LZ77 is short for "Limpel Ziv 1977", because it was formulated and presented in a paper by two scientists named Limpel and Ziv in 1977. It's a simple (at least conceptually) algorithm for compressing data. ## Algorithm Concept ### Compression 1. Read data in order, keeping track of what you've read thus far. 2. When you find something you've already read earlier, you 1. **remove** that content 2. count back how many bits (or characters, conceptually) you removed - call this Y 3. count how far back the instance you kept was from the instance you removed - call this X 4. **insert a short code containing 2 numbers**, X and Y ### Expansion 1. Find all the short codes, for each 1. read the numbers and go look up whatever content they point to. 2. grab that content 3. replace the short code with the content **** # More ## Source - https://youtu.be/aoag03mSuXQ?t=1120&si=EVqUsG_jiQ6VIb4Y