Author: Levindo Gabriel Taschetto Neto
The dangling suffix checking is a technique which might be used to test the unique decodability of a code.
Symbols | Code A |
---|---|
A | 0 |
B | 10 |
C | 001 |
["0", "10", "001"]
["0", "10", "001", "01"] # Because "0" is suffix of "001"
["0", "10", "001", "01", "1"] # Because "0" is suffix of "01", so the rest "1" ought be added in the list
["0", "10", "001", "01", "1", "0"] # Because "1" is suffix of "10", so the rest "0" ought be added in the list
Thus, during the execution, two elements with the same value were found. In this case, the code A is labeled as "not uniquely decodable"
Python 3.6.1 which can be download here
$ python main.py
MIT License. Click here for more information about this license.