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 7443997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:25:20+00:00 2026-05-29T11:25:20+00:00

Im trying to better understand how the huffman decoder works. Ive got a code

  • 0

Im trying to better understand how the huffman decoder works. Ive got a code table but im having a hard time trying to understand how the decoder would work because of ambiguity in the binary string.

(im learning this in prep for my final year at uni)

my table:

Data  Hcode
0,     0
1,     1
2,     10
3,     11
17,    100
18,    101
19,    110
29,    111

If i have a huffman code string like 010011 i can return many different combinations of data so how can i discriminate?

i understand the huffman logic in BST representation and you follow a path to a given leaf which the path resembles the code for that given value between (0-255(ascii)) but i still dont know how you can discriminate between returning data: 0,1,0 or data: 0,17

do i really have to enforce 2 bit codes on data 0 and 1? (00 and 01)

i hope ive explained the best i can XD

If your wondering how I generated the table – your gonna kill me because i didnt use tree logic to generate it. Althought i sorted the data (random bytes) on frequency – i generated the Hcodes by converting the element position number into binary (hency why i called this post Poor Mans Huffman).

Many Thanks for any advice.

  • 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-29T11:25:21+00:00Added an answer on May 29, 2026 at 11:25 am

    The code table is wrong. Huffman odes are supposed to be prefix free. This is neccessary in order to decode them afterwards without ambiguities.

    If you would use a binary tree for creating the codes, this would automatically ensure the “prefix freeness”. See: http://en.wikipedia.org/wiki/Huffman_coding

    And now, I am going to kill you … 😉

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

Sidebar

Related Questions

I'm trying to better understand c, and I'm having a hard time understanding where
I've seen some examples, but trying to better understand how Resource files work, such
Trying to understand Ruby a bit better, I ran into this code surfing the
I'm trying to understand the django admin better and at the same time, I'm
I've been searching for tutorials to better understand this, but I'm having no luck.
I'm trying to better understand what exactly this code is doing. It's written in
I am trying to better understand how validation works in a Windows Forms application.
So I've been trying to better understand the difference between these two but all
I am trying to better understand how a function works. I am not familiar
I'm trying to understand better how data binding works in .net. I was checking

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.