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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:39:44+00:00 2026-06-13T07:39:44+00:00

I am working on a Huffman Tree based off of a frequency table. The

  • 0

I am working on a Huffman Tree based off of a frequency table. The frequency table is generated from counting the frequency of characters in a given string and placing the respective item (character and frequency) in a LinkedList. I then need to place the items in a Huffman Tree in order of their frequency. I get that the logic behind it is to make sure there are right and left nodes to each subtree, add their frequencies, create a root node with their added frequencies, place the next frequencies in the left and right trees respectively and repeat this process until there are no more frequencies and the subtrees are connected with a root that adds their frequencies; the trouble I am having is figuring out how to implement the code.

The code is rather extensive so I would rather avoid posting all of it, the general layout is that I have a HuffmanFrequencyTable class that allows me to build the table, a HuffmanTreeNode class that allows us to create nodes to place in the tree, and a HuffmanTree class that helps us create the actual tree. An encode class then inputs a string and builds the tree from the string using the HuffmanFrequencyTable it creates. This is a homework problem so please do not provide solutions, I am just hoping for some help in figuring out the logic in the code of it.

Right now, I am creating an array of characters that have been placed in the tree, finding the lowest frequency among characters remaining in the table that aren’t in the array, and attempting to place them in leafs. When the base leafs are full in the subtrees I am trying to add those values, create a node, and continue up the tree. I am using a for loop for this. Does this seem like the right start?

  • 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-06-13T07:39:44+00:00Added an answer on June 13, 2026 at 7:39 am

    Yes. you are on the right track.

    And for decoding you use the same tree and and traverse left or right till you reach a leaf node and that is the character.

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

Sidebar

Related Questions

Working sample using one Table SELECT t.* FROM ( SELECT TITLE.name, (TITLE.value-TITLE.msp) AS Lower,
I am currently working on implementing a program based on the huffman algorithm in
I am working a school project to implement a Huffman code on text. The
Working on game where plates will be falling from top to bottom. Some plates
Im working on a method for insertion into priority queue using the huffman method.
Working on dom html . I want to convert node value to string: $html
I'm working Huffman coding of any .txt file, so first I need to analyse
We are working an algorithm that calculate the optimal way to move resources from
Working on calling a C function from my asm project. I'm trying to push
I'm working on a quick sort algorithm for a Huffman coding project I'm working

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.