bm_pyflate.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:performance 作者: python 项目源码 文件源码
def bwt_transform(L):
    # Semi-inefficient way to get the character counts
    if six.PY3:
        F = bytes(sorted(L))
    else:
        F = b''.join(sorted(L))
    base = []
    for i in range(256):
        base.append(F.find(six.int2byte(i)))

    pointers = [-1] * len(L)
    for i, symbol in enumerate(six.iterbytes(L)):
        pointers[base[symbol]] = i
        base[symbol] += 1
    return pointers
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号