implement createCodeTree() and decode()
fix createCodeTree()
implement encode()
implement the rest