java
fighterfate
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
顺序排序
public class ArrayTest { /** * @param args */ public static void main(String[] args) { // 对给定的数组进行排序--选择排序 int[] arr=new int[]{1,2,4,2,6,3,5,7,3,9}; //排序前 printArray(arr); select原创 2013-07-06 18:34:26 · 602 阅读 · 0 评论 -
冒泡排序
public class ArrayTest4 { /** * @param args */ public static void main(String[] args) { //冒泡排序,相邻的两个元素进行比较,如果符合条件就换位,第一轮最后一个数是最值 // 对给定的数组进行排序--选择排序 int[] arr=new int[]{1,2,4,2,6,3原创 2013-07-07 13:15:52 · 464 阅读 · 0 评论 -
折半查找
import java.util.Arrays; public class ArratTest5 { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub int[] arr=new int[]{1,2,4,2,6,3,5,7,3,9原创 2013-07-07 14:38:52 · 381 阅读 · 0 评论 -
不需要第三个变量交换两个变量值的两种方法
//不需要第三方变量互换变量,如果nm的值比较大容易超出范围 int n=3,m=8; System.out.println("n="+n+",m="+m); n=n+m; m=n-m; n=n-m; System.out.println("n="+n+",m="+m); //不需要第三方变量互换变量,不超出范围 int n=3,m=8; System.o原创 2013-06-27 21:34:12 · 505 阅读 · 0 评论
分享