关于数据分类的一个新的有效算法

A New Efficient Algorithm For Internal Sorting

  • 摘要: 本文提出了一种新的分类算法,该算法特别适用于分类元素关键字值重复性较高的元素集。新算法采用了我们称之为单指针队列移动的思想,通过扫描全部元素一遍或二遍便将其分类完。当对关键字值仅有M种的共N个元素分类时,新算法的排序效率,即总的比较次数为O(N LOG2M),元素总移动次数为O(MN),所需附加空间为M个指针单元和M个存关键字值单元。在极端情况下,即M与N相等时,以上时空效率的形式不改变。
    约定:若元素a和b具有相同的关键字值,则称元素a和b是同类元素。反之,亦然。

     

    Abstract: In this paper,a new internal sorting algorithm is presented which is especially suited for sorting record set in which the total number of key values is much smaller than that of records Viz.many records have the same value. If we assume the total number of records to be sorted is N and the total number of key values is M,the sorting efficiency-the total number of comparisons-of classical algorithms (e. g. quicksort,heapsort) is O(N·log2N), unrelated to M. Under the same assumption,the sorting efficiency of the new algorithm presented in this paper that uses one kind of queue with single pointer data structure, through two passes, is 2·N·log2M.If some conditioing are added,only one pass is needed and the efficiency is N·log2M.The moving total number of the new algorithm is N·M/4,and the extra memory space required is M,pointers and M key value locations.

     

/

返回文章
返回