Question

Here is some of the code I have - My issue is in the generateTable() function:

I have created a Huffman Code tree and I want to output each node's location so that it appears like so:

10 111100
32 110
33 1010110110
34 10101111
38 01100110110101110011
39 1110101011
40 1010110111011101
41 011001101101010

Why won't that function write to the file properly? (I ask because that code was provided to me by my professor and I don't understand the problem.) When I open the file it is empty.

Was it helpful?

Solution

If this is the exact code that was provided to you, then you should probably implement the orderNodes and readFileIn functions. They currently do nothing besides returning the empty ArrayHeap that is created in the line before they are called.

Also, I'm surprised that HTree.generateTable(...) even works, as it is not instantiated as an instance of HuffManNode (as far as I can see)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top