/**
* This method is called to generate your tree. The return type is void because this method simply creates the tree. The other methods
* will be used to encode or decode the message.
*
* @param message The message that should be used to create the tree
*/
void createTree(string message)
{
}
I have been given this code. I am totally confused on where to start. I have to create a Huffman Tree with a string of message such as.
"muckduck! muuuud draumak pmdap dp ucmr, paumeu dpapkam. mka. rpkuakdap pamk aprckpku.arp pruak, dcd ckap! r! p! .!mrp"
But I do not know where to start.
I need to know how to count the frequency of the individual letters like
There is 10 "m", 8 "k", for example.
I do not know how to make my program identify that.
I think I only need help identifying the number of each characters in a string. Then I should be good to go. Ifinished everything else such as writing the encoding, decoding formulas.
I think I only need help identifying the number of each characters in a string
Well that shouldn't be too difficult for you to iterate through the string and build up a count of each character. The way I would do it would be to have an array of 'int's of size 26, use each ASCII value as the index...