这是什么算法/程序的名称? [英] What's the name of this algorithm/routine?

查看:148
本文介绍了这是什么算法/程序的名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在写这从一个字母到另一个字符串转换成一个工具类,这是在你有一个目标字母你想使用,以限制可用的字符数情况下非常有用。例如,如果你可以用小写字母和数字,但只有12个字符的可能COM preSS时间戳从字母表 01234567989 - abcdefghijklmnopqrstuvwxyz01234567989 2010-10-29 13时14分○○秒有可能成为 5hhyo9v8mk6avy (19字数减少到16)。

I am writing a utility class which converts strings from one alphabet to another, this is useful in situations where you have a target alphabet you wish to use, with a restriction on the number of characters available. For example, if you can use lower case letters and numbers, but only 12 characters its possible to compress a timestamp from the alphabet 01234567989 -: into abcdefghijklmnopqrstuvwxyz01234567989 so 2010-10-29 13:14:00 might become 5hhyo9v8mk6avy (19 charaters reduced to 16).

类是设计来转换来回字母之间,并且还计算出可安全地存储在一个目标字母给定的字符的特定数目的源最长字符串

The class is designed to convert back and forth between alphabets, and also calculate the longest source string that can safely be stored in a target alphabet given a particular number of characters.

想通过谷歌code发布此的,但我明明喜欢别人找到它,并用它 - 因此,什么这就是所谓的问题。我有,当你需要生成一定长度的唯一文件名使用此方法在两个独立的项目,彭博社和专有的系统,而是希望将一些明文,所以GUID是不恰当的。

Was thinking of publishing this through Google code, however I'd obviously like other people to find it and use it - hence the question on what this is called. I've had to use this approach in two separate projects, with Bloomberg and a proprietary system, when you need to generate unique file names of a certain length, but want to keep some plaintext, so GUIDs aren't appropriate.

推荐答案

您的例子某些相似之处到的词典codeR 有一个固定的目标和源词典。另外值得考虑的是斐波那契数编码,其中有一个固定的目标字典可变长度位( ),其可变地靶向

Your examples bear some similarity to a Dictionary coder with a fixed target and source dictionaries. Also worthwhile to look at is Fibonacci coding, which has a fixed target dictionary (of variable-length bits), which is variably targeted.

我觉得这也取决于它是否是非常重要的,你的目标字母都有固定宽度的条目 - 如果你允许一个固定的字母与可变长度codeS,你的COM pression比例将接近你的熵是多少更优化!如果源字母分配预先已知,静态霍夫曼树的可以很容易地产生。

I think it also depends whether it is very important that your target alphabet has fixed width entries - if you allow for a fixed alphabet with variable length codes, your compression ratio will approach your entropy that much more optimally! If the source alphabet distribution is known in advance, a static Huffman tree could easily be generated.

这篇关于这是什么算法/程序的名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆