You are viewing a single comment's thread. Return to all comments →
Your comment is misguiding. We need to either check if a node is leaf by checking for left and right NULL OR we can check whether the char data of node is empty or not.
And what is the property of Huffman code you are referring to.
in a huffman tree, a parent node will always have 2 child as we begin by combining 2 nodes and repeat it untill we are done. due to this property, we can safely say that if either of the left or right pointer is null, the other one is also null, and hence it is a leaf node.