文件名称:利用双向走动法改进冒泡排序算法C语言源代码
介绍说明--下载内容来自于网络,使用问题请自行百度
传统的冒泡排序法是这样操作:从前往后,依次比较两个相邻的元素,如果逆序则交换这两个元素值,然后继续往后操作;到了数据尾部时,就找出了一个最大值(或最小值)。然后重复上面的操作n-1次(n为元素个数)。相关的改进办法:按照上面的办法来操作的话,第一次扫描把最大数(或最小数)放到最后面的位置,第二次扫描时其实只需要扫描到倒数第二个位置就可以了,因为最后一个位置已经不需要判断了,以后的操作都是类似的。这样可以减小程序运行时间。-traditional Bubble Sort method is operated : former next, followed by two more adjacent elements, if Roget will exchange value of the two elements, and then continue later operation; The tail of the data, it found a maximum (or minimum). Then repeat the operation of the above n-1 (n is the number of elements). The improvements : In accordance with the above approach to the operation of the first scanning the maximum (or minimum number) onto the surface of the final location of the second scan in fact only need to scan the penultimate position can be, a place for the final judgment has not come to the end of operation are similar. Such procedures can reduce the run time.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
利用双向走动法改进冒泡排序算法C语言源代码 .doc
www.dssz.com.txt
www.dssz.com.txt
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.