Compress the text "ABABCBCAC" using Huffman coding and provide the resulting compressed representation.
Here, due to the non-determinism of the Huffman code please follow the rules specified below:
- For each pair of branches, the left branch is assigned "0" and the right branch is assigned "1".
- All nodes are placed in the descending order of their frequency. Meaning the nodes with higher frequency are placed on the right side whereas the ones with less frequency are placed on the left. This also means for any parent node the child on the right side will always have a higher frequency compared to the child node on the left.
- When multiple nodes/characters have the same frequency they maintain the same order as their occurrence.