Huffman tree implementaion

Could you please help with writing the code in C++ The vector code_lengths, where code_lengths[i] is the number of leaves at depth i + 1 (if root has depth 0), is input to the class. Also input the values written in the leaves of this tree in the "left subtree first, then right subtree second" traversal order. Also implement the Move method, which implements an interface to move along an edge with a given bit value of the tree from the current vertex. If the final vertex of the edge is a leaf, the value in the leaf should be written to the passed variable and returned true. The current vertex in the tree is reset, and the next time the method is called, the initial vertex will not be the leaf of the tree.

Translated with www.DeepL.com/Translator (free version)


Ответы (0 шт):