冒泡排序
来源:互联网 发布:mac terminal 游戏 编辑:程序博客网 时间:2024/06/07 11:15
package shan.com;
public class maopao ...{
/** *//**
* @param args
*/
public static void main(String[] args) ...{
// TODO 自動生成されたメソッド・スタブ
maopao();
maopao2();
maopao3();
maopao4();
}
public static void maopao() ...{
double[] in = ...{ 1, 2, -3, 40, 6, 8, 4, 5 };
int temp;
for (int i = 0; i < in.length; i++) ...{
for (int j = i; j < in.length; j++) ...{
if (in[j] < in[i]) ...{
temp = (int) in[j];
in[j] = in[i];
in[i] = temp;
}
}
}
for (int i = 0; i < in.length; i++)
System.out.println(in[i]);
System.out
.println("**************************************************************************************************");
}
public static void maopao2() ...{
double[] in = ...{ 1, 2, -3, 40, 6, 8, 4, 5 };
int temp;
for (int i = 0; i < in.length; i++) ...{
for (int j = i; j < in.length; j++) ...{
if (in[j] < in[i]) ...{
temp = (int) in[i];
in[i] = in[j];
in[j] = temp;
}
}
}
for (int i = 0; i < in.length; i++)
System.out.println(in[i]);
System.out
.println("**************************************************************************************************");
}
public static void maopao3() ...{
double[] in = ...{ 1, 2, -3, 40, 6, 8, 4, 5 };
int temp;
for (int i = 0; i < in.length; i++) ...{
for (int j = i; j < in.length; j++) ...{
if (in[j] > in[i]) ...{
temp = (int) in[j];
in[j] = in[i];
in[i] = temp;
}
}
}
for (int i = 0; i < in.length; i++)...{
System.out.println(in[i]);
try...{
Thread.sleep(1000);
}catch(Exception e)...{
System.out.println(e.toString());
}
}
System.out
.println("**************************************************************************************************");
}
public static void maopao4() ...{
double[] in = ...{ 1, 2, -3, 40, 6, 8, 4, 5 };
int temp;
for (int i = 0; i < in.length; i++) ...{
for (int j = i; j < in.length; j++) ...{
if (in[j] > in[i]) ...{
temp = (int) in[i];
in[i] = in[j];
in[j] = temp;
}
}
}
for (int i = 0; i < in.length; i++)
System.out.println(in[i]);
System.out
.println("**************************************************************************************************");
}
}
public class maopao ...{
/** *//**
* @param args
*/
public static void main(String[] args) ...{
// TODO 自動生成されたメソッド・スタブ
maopao();
maopao2();
maopao3();
maopao4();
}
public static void maopao() ...{
double[] in = ...{ 1, 2, -3, 40, 6, 8, 4, 5 };
int temp;
for (int i = 0; i < in.length; i++) ...{
for (int j = i; j < in.length; j++) ...{
if (in[j] < in[i]) ...{
temp = (int) in[j];
in[j] = in[i];
in[i] = temp;
}
}
}
for (int i = 0; i < in.length; i++)
System.out.println(in[i]);
System.out
.println("**************************************************************************************************");
}
public static void maopao2() ...{
double[] in = ...{ 1, 2, -3, 40, 6, 8, 4, 5 };
int temp;
for (int i = 0; i < in.length; i++) ...{
for (int j = i; j < in.length; j++) ...{
if (in[j] < in[i]) ...{
temp = (int) in[i];
in[i] = in[j];
in[j] = temp;
}
}
}
for (int i = 0; i < in.length; i++)
System.out.println(in[i]);
System.out
.println("**************************************************************************************************");
}
public static void maopao3() ...{
double[] in = ...{ 1, 2, -3, 40, 6, 8, 4, 5 };
int temp;
for (int i = 0; i < in.length; i++) ...{
for (int j = i; j < in.length; j++) ...{
if (in[j] > in[i]) ...{
temp = (int) in[j];
in[j] = in[i];
in[i] = temp;
}
}
}
for (int i = 0; i < in.length; i++)...{
System.out.println(in[i]);
try...{
Thread.sleep(1000);
}catch(Exception e)...{
System.out.println(e.toString());
}
}
System.out
.println("**************************************************************************************************");
}
public static void maopao4() ...{
double[] in = ...{ 1, 2, -3, 40, 6, 8, 4, 5 };
int temp;
for (int i = 0; i < in.length; i++) ...{
for (int j = i; j < in.length; j++) ...{
if (in[j] > in[i]) ...{
temp = (int) in[i];
in[i] = in[j];
in[j] = temp;
}
}
}
for (int i = 0; i < in.length; i++)
System.out.println(in[i]);
System.out
.println("**************************************************************************************************");
}
}
- 冒泡排序
- 冒泡排序
- 冒泡排序
- 冒泡排序
- 冒泡排序
- 冒泡排序
- 冒泡排序
- 冒泡排序
- 冒泡排序
- 冒泡排序
- 冒泡排序
- 冒泡排序
- 冒泡排序
- 冒泡排序
- 冒泡排序
- 冒泡排序
- 冒泡排序
- 冒泡排序
- 透过汇编另眼看世界之多继承下的虚函数函数调用
- 超级简单拖动层
- 通过COM技术实现Windows Shell编程(图)
- [转]Prize winner in Competition "Best C++/MFC article of May 2007"
- VB 避免程序二次运行
- 冒泡排序
- 有符号和无符号如何进行比较
- 匹配
- Windows下动态内存分配方式
- HTTP协议的作用原理
- 正则表达式获取HTML标记中的内容(C#)
- 二进制数据读取
- 关于获取u盘,移动硬盘设备信息的问题
- 透过汇编另眼看世界之函数调用