一种基于动态交换的计数排序算法
A Counting Sort Algorithm Based on Dynamic Exchange
-
摘要: 提出一种动态交换的策略, 对一个元素计数后, 根据计数值的大小将元素移动到序列的合适位置,使得算法在每运算一个元素后, 元素间的排列都是有序的, 计数值大的元素位于序列的前端, 从而有效地减少了查询时间. 分析了算法的时间及空间复杂度, 并通过实验验证了算法的实时性与高效性.Abstract: To ensure elements were in the proper position after each element was calculated, a dynamic exchange strategy was presented to exchange the element’s position according to the element’s counting value. The element having the bigger counting value was set to the frontier position, which reduces effectively the query time. The complexity of time and space were also analyzed and the real-time and efficiency were verified through the experiment