我想创建一个像哈夫曼代码,但对字符后缀免费代码列表。例如:
a ~~> Word with high Frequency
.
.
.
baz ~~> Word with lower Frequency
我在python中使用这个函数来生成字符序列
def iter_all_strings():
size = 1
while True:
for s in itertools.product(ascii_lowercase, repeat=size):
yield "".join(s)
size +=1
但它们不是无前缀的,我怎么能做到呢?你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐