Yesterday, I promised to help others write a Huffman compression job. According to the data structure book, I used a typical Huffman tree with * lchild, * rchild binary tree structure to represent the generated Huffman tree, then we will get the Huffman code out, and we will be depressed. No matter recursive or non-recursive traversal, we will not be able to record the node hierarchy well. Today, I have read some other people's discussions online. This tree can be placed in an array or a linked list. Each node has a * parent, to find the encoding of a character, search for its node in the linear structure, and retrieve the node layer by layer ..
The brain does not need to rust out. This tree is often used when it is a sophomore. There are books that need to be thoroughly understood. If it is not used up, it will be fixed-thinking, in addition to taking exams, teaching materials are also used to give people the opposite picture ~