|Just another Perl shrine|
Hi Limbic. Good to speak to you again. :-) I don't understand some things you have said.
With the Huffman Coding problem I wanted to take any "holes" in the tree and plug them with some high frequency character tuples.
The reason I don't get this is because normally there are no holes in a properly constructed huffman tree. The tree is "full", that is every node either has two child nodes or is a leaf node with no children, or in other words there are no nodes with only 1 child. This is a necessary aspect of huffman encoding.
Your updates seem to suggest that you aren't going to be doing huffman encoding at all, but some kind of dictionary mapping to fixed size output tokens. Also you said:
when comparing the frequencies 'HE' is the biggest bang for the buck. After substituting it, THEN needs to be knocked out of the list entirely.
It is not clear why this is so. Is this because you aren't allowed overlapping sequences? Or some other reason. Can you explain more?
Anyway, it sounds like this problem is NP hard, so if you really want the perfect solution you will have to brute force it. IMO you dont need to, you can find a "good enough" solution with a couple of iterations I should think. Especially as you say a certain set must appear in the table.