文件名称:shuangxiangmaobao
-
所属分类:
- 标签属性:
- 上传时间:2013-12-24
-
文件大小:737byte
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
以整数升序排序为例来简单说明一下双向冒泡排序的过程:首先从前往后把最大数移到最后,然后反过来从后往前把最小的一个数移动到数组最前面,这一过程就是第一轮,然后重复这一过程,最终就会把整个数组从小到大排列好。双向冒泡排序要稍微优于传统的冒泡排序,因为双向排序时数组的两头都排序好了,我们只需要处理数组的中间部分即可,而单向即传统的冒泡排序只有尾部的元素是排好序的,这时每轮处理都需要从头一直处理到已经排好序元素的前面一个元素。虽然它在效率上有了点改进,但它也不能大幅度提高其排序的效率,这是由冒泡排序的基本过程所决定了的。在此基础上改进了一下,下面的代码可以实现对奇数偶数分别排序:
-Integers in ascending order as an example to explain the simple process of bidirectional bubble sort: the maximum number of front to back first to the last, and then turn back to front of the smallest number of moves to the top of the array, this process is The first round, and then repeat the process, and ultimately the entire array will be lined up from small to large. Bidirectional bubble sort to be slightly superior to the traditional bubble sort, because two-way sorting two arrays are sorted Well, we only need to deal with the middle part of the array, and the way that only the tail of the traditional elements of a bubble sort is sorted, then each round of treatment requires de novo already sorted elements have been treated to an element. While it has been point improvement in efficiency, but it can not significantly improve the efficiency of its sort, which is the basic process of bubble sort of decision. Based on this improved a bit, the following code can be achieved on odd and
-Integers in ascending order as an example to explain the simple process of bidirectional bubble sort: the maximum number of front to back first to the last, and then turn back to front of the smallest number of moves to the top of the array, this process is The first round, and then repeat the process, and ultimately the entire array will be lined up from small to large. Bidirectional bubble sort to be slightly superior to the traditional bubble sort, because two-way sorting two arrays are sorted Well, we only need to deal with the middle part of the array, and the way that only the tail of the traditional elements of a bubble sort is sorted, then each round of treatment requires de novo already sorted elements have been treated to an element. While it has been point improvement in efficiency, but it can not significantly improve the efficiency of its sort, which is the basic process of bubble sort of decision. Based on this improved a bit, the following code can be achieved on odd and
(系统自动生成,下载前可以参看下载内容)
下载文件列表
shuangxiangmaobao.txt
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.