You are viewing a single comment's thread. Return to all comments →
I dont know what do they put in the data of Internal nodes for python language, so I just checked if the data is an alphabet or a punctuation
import string def decodeHuff(root, s): rootcopy = root L = [int(_) for _ in s] while L: temp = L.pop(0) if temp: rootcopy = rootcopy.right else: rootcopy = rootcopy.left if rootcopy.data.isalpha() or rootcopy.data in string.punctuation: print(rootcopy.data, end='') rootcopy = root
Seems like cookies are disabled on this browser, please enable them to open this website
Tree: Huffman Decoding
You are viewing a single comment's thread. Return to all comments →
I dont know what do they put in the data of Internal nodes for python language, so I just checked if the data is an alphabet or a punctuation