Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 280423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T05:07:02+00:00 2026-05-12T05:07:02+00:00

So I’ve been thinking lately about how compression might be implemented, and what I’ve

  • 0

So I’ve been thinking lately about how compression might be implemented, and what I’ve postulated so far is that it might be using a sort of HashTable of ‘byte signature’ keys with memory location values where that ‘byte signature’ should be replaced upon expansion of the compressed item in question.

Is this far from the truth?

How is compression typically implemented? No need for a page worth of answer, just in simple terms is fine.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T05:07:03+00:00Added an answer on May 12, 2026 at 5:07 am

    Compressing algorithms try to find repeated subsequences to replace them with a shorter representation.

    Let’s take the 25 byte long string Blah blah blah blah blah! (200 bit) from An Explanation of the Deflate Algorithm for example.

    Naive approach

    A naive approach would be to encode every character with a code word of the same length. We have 7 different characters and thus need codes with the length of ceil(ld(7)) = 3. Our code words can than look like these:

    000 → "B"
    001 → "l"
    010 → "a"
    011 → "h"
    100 → " "
    101 → "b"
    110 → "!"
    111 → not used
    

    Now we can encode our string as follows:

    000 001 010 011 100 101 001 010 011 100 101 001 010 011 100 101 001 010 110
    B   l   a   h   _   b   l   a   h   _   b   l   a   h   _   b   l   a   !
    

    That would just need 25·3 bit = 75 bit for the encoded word plus 7·8 bit = 56 bit for the dictionary, thus 131 bit (65.5%)

    Or for sequences:

    00 → "lah b"
    01 → "B"
    10 → "lah!"
    11 → not used
    

    The encoded word:

    01 00    00    00    00    10
    B  lah b lah b lah b lah b lah!
    

    Now we just need 6·2 bit = 12 bit for the encoded word and 10·8 bit = 80 bit plus 3·8 bit = 24 bit for the length of each word, thus 116 bit (58.0%).

    Huffman code approach

    The Huffman code is used to encode more frequent characters/substrings with shorter code than less frequent ones:

    5 × "l", "a", "h"
    4 × " ", "b"
    1 × "B", "!"
    
    // or for sequences
    
    4 × "lah b"
    1 × "B", "lah!"
    

    A possible Huffman code for that is:

    0      → "l"
    10     → "a"
    110    → "h"
    1110   → " "
    11110  → "b"
    111110 → "B"
    111111 → "!"
    

    Or for sequences:

    0  → "lah b"
    10 → "B"
    11 → "lah!"
    

    Now our Blah blah blah blah blah! can be encoded to:

    111110 0 10 110 1110 11110 0 10 110 1110 11110 0 10 110 1110 11110 0 10 110 1110 11110 0 10 110 111111
    B      l a  h   _    b     l a  h   _    b     l a  h   _    b     l a  h   _    b     l a  h   !
    

    Or for sequences:

    10 0     0     0     0     11
    B  lah b lah b lah b lah b lah!
    

    Now out first code just needs 78 bit or 8 bit instead of 25·8 = 200 bit like our initial string has. But we still need to add the dictionary where our characters/sequences are stored. For our per-character example we would need 7 additional bytes (7·8 bit = 56 bit) and our per-sequence example would need again 7 bytes plus 3 bytes for the length of each sequence (thus 59 bit). That would result in:

    56 + 78 = 134 bit (67.0%)
    59 +  8 =  67 bit (33.5%)
    

    The actual numbers may not be correct. Please feel free to edit/correct it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 144k
  • Answers 144k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer While it's not bad to have a column in multiple… May 12, 2026 at 8:36 am
  • Editorial Team
    Editorial Team added an answer It sounds as though you are performing a database restore… May 12, 2026 at 8:36 am
  • Editorial Team
    Editorial Team added an answer From Fx.Slide.js: Fx.Slide = new Class({ /* .. */ initialize:… May 12, 2026 at 8:36 am

Related Questions

So I'm getting a new job working with databases (Microsoft SQL Server to be
So I have a Sybase stored proc that takes 1 parameter that's a comma
So I'm embarking on an ASP.NET MVC project and while the experience has been
So I've got a JPanel implementing MouseListener and MouseMotionListener : import javax.swing.*; import java.awt.*;
So I wrote some perl that would parse results returned from the Amazon Web

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.