经典排序算法 - 冒泡排序Bubble sort
原理是临近的数字两两进行比较,按照从小到大或者从大到小的顺序进行交换,
这样一趟过去后,最大或最小的数字被交换到了最后一位,
然后再从头开始进行两两比较交换,直到倒数第二位时结束,其余类似看例子
例子为从小到大排序,
原始待排序数组| 6 | 2 | 4 | 1 | 5 | 9 |
第一趟排序(外循环)
第一次两两比较6 > ...
分类:
编程语言 时间:
2014-12-16 13:34:29
阅读次数:
189
1 package com.java7; 2 3 class Bubble { 4 public static void main(String[] args) { 5 int nums[] = { 99, -10, 100123, 18, -978, 5623, 463...
分类:
其他好文 时间:
2014-12-15 18:36:26
阅读次数:
157
常见用的排序算法学习1.冒泡排序基本思想:两两比较待排序序列中的元素,并交换不满足顺序要求的各对元素,直到全部满足顺序要求为止。C代码:void bubble_sort(int arr[],int n){ int j; while (n>0) { for (j ...
分类:
编程语言 时间:
2014-12-05 16:47:49
阅读次数:
174
> library(lattice)> library(sp)> data(meuse)> coordinates(meuse) spplot(meuse, "zinc", do.log=T)> bubble(meuse, "zinc", do.log=T, key.space="bottom")....
分类:
编程语言 时间:
2014-11-26 13:48:30
阅读次数:
315
冒泡排序: 1 //复杂度:O(n^2) 2 //比较次数:n*(n-1)/2 ;移动等数量级 3 #include 4 #include 5 #include 6 using namespace std; 7 const int INF = 0x7fffffff; 8 void Bubble_so...
分类:
编程语言 时间:
2014-11-26 01:13:42
阅读次数:
332
来源:http://www.ido321.com/1214.html
前两天翻译了一篇文章,关于利用css的border属性制作基本图形:http://www.ido321.com/1200.html
在此基础上,今天分享一篇文章给大家,如果利用CSS制作冒泡提示框。
先看2张效果图:
CSS:
/*
对话气泡
用法:使用.speech-bubble和.speech-bubble-DIRECTION类
<div class="speech-bubble speech-bubble...
分类:
Web程序 时间:
2014-11-18 13:36:53
阅读次数:
169
主要有两种方式:往项目的res/raw目录中放入音效文件。1、MediaPlayer播放一般音频private void playSound(){ final MediaPlayer mediaPlayer = MediaPlayer.create(activity, R.raw.bubble);....
分类:
移动开发 时间:
2014-11-18 13:13:41
阅读次数:
402
//冒泡排序void Bubble_Sort(int *a,int n)/*定义两个参数:数组首地址与数组大小*/{ int i,j,temp; for(i=0;ia[j+1]) { temp=a[j]; a[j]=a[+1]; a[j+1]=temp; }...
分类:
编程语言 时间:
2014-11-15 23:05:28
阅读次数:
259
事件冒泡时,触发click事件: 1 2 3 4 5 Bubble Test 6 7 8 Div 9 10 27 事件捕获时,触发click事件: 1 2 3 4 5 Bubble Test 6 7 8 Div 9 10 27
分类:
其他好文 时间:
2014-11-09 19:30:28
阅读次数:
203
We have 8 numbers. Sort as ascend.1st loop, we compare 7 times (for 8 numbers), and found the largest 8.2nd loop, we compare 6 times (for 7 numbers), ...
分类:
其他好文 时间:
2014-11-09 12:24:42
阅读次数:
184