Open
Description
Thanks for this great open source resource! I think I may have noticed a potential bug, however. In the Decoder, the user provides:
input_file, n = argv[1:]
maximum_table_size = pow(2,int(n))
But, they're not used anywhere in the following code. I believe the following change is in order:
if not(len(string) == 0):
dictionary[next_code] = string + (dictionary[code][0])
next_code += 1
string = dictionary[code]
Should be:
if not(len(phrase) == 0):
if(len(dictionary) <= maximum_table_size):
dictionary[next_code] = phrase + (dictionary[code][0])
next_code += 1
phrase = dictionary[code]
I ran the code with this change and it continued to work. Thoughts?
Metadata
Metadata
Assignees
Labels
No labels