摘要: 计数排序/** *@param array is the array to sort *@param length is the length of the array *@param range is the range of the whole numbers in array */void CountingSort(int* array, int length, int range){//this algorithm needs two auxiliary, one for counting the total number of the digits, one for placing 阅读全文
posted @ 2013-10-26 14:15 Wolves_群狼 阅读(205) 评论(0) 推荐(0) 编辑
摘要: 基数排序分为从低位到高位,和从高位到低位两种。一、从低位到高位采用计数排序才完成每一趟的排序,每一趟计数排序都是对带排序数组某一位的排序。void RadixSort(int* array, int length){ int* auxiliary_array = new int[length];//for placing sorted digits int* digit_array = new int[length];//record the certain digit of the number in array for (int digit = 1; true; ++di... 阅读全文
posted @ 2013-10-26 13:54 Wolves_群狼 阅读(198) 评论(0) 推荐(0) 编辑