摘要
现有的排序算法很难实现自定义顺序的字符串排序,提出一种自定义顺序的字符串快速排序方法.在应用连续编号定义字符排序顺序的基础上,使用哈希表结构将字符串转换成对应的整型数组,以字符的最大编号作为基数排序算法的新基数,实现字符串的基数排序.分析和实验表明,本文方法可有效实现自定义顺序的字符串排序,是一个时间和空间复杂度都是线性的排序算法,比快速排序(Quick Sort)具有更好的时间性能,且可以方便地推广到其它语言的字串排序中.
Existing sort algorithms are difficult to implement string sort in a custom order of characters. This paper presents a fast string sort method in custom character order. On the basis of the consecutive numbers which used to define the custom order of char- acters, the hash table structure is employed to convert each string into corresponding array of integers. By taking the maximum num- ber of characters as the new radix, the radix sort algorithm is used to implement fast sort of strings in custom order. Theory analysis and experiments show that the method of this paper can easily achieve string sort in custom order in linear time and space complexity. This method has a better time performance than that of Quick Sort algorithm, and it can easily extend to string sort applications of oth- er languages.
出处
《小型微型计算机系统》
CSCD
北大核心
2012年第9期1968-1971,共4页
Journal of Chinese Computer Systems
基金
国家自然科学基金项目(61163045
31040050)资助
新疆师范大学博士后科研启动基金项目(XJNUBS1111)资助