Concept Flow - Huffman Encoding
Count frequencies of chars
Create leaf nodes for each char
Build min-heap from leaf nodes
While heap size > 1
Extract two smallest nodes
Create new internal node with these two
Insert new node back to heap
Heap size == 1 -> Root node
Traverse tree to assign codes
Return char-to-code map
The flow counts character frequencies, builds a tree by combining smallest nodes, then assigns codes by traversing the tree.
