2007年12月27日
摘要: 选择排序 1public void selectionSort() 2{ 3 int out,in,min; 4 5 for(out=0;out<nElems-1;out++) 6 { 7 min=out; 8 9 for(in=out+1;in<nElems;in++) 10 if(a... 阅读全文
posted @ 2007-12-27 22:22 蓝蓝的天2016 阅读(97) 评论(0) 推荐(0) 编辑
摘要: Bubble Sort 1class ArrayBub 2{ 3 private long[] a; 4 private int nElems; 5 6 public ArrayBub(int max) 7 { 8 a=new long[max]; 9 nElems=0; 10 } 11 12 ... 阅读全文
posted @ 2007-12-27 17:30 蓝蓝的天2016 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 主要研究三种 Bubble Sort 冒泡排序 Selection Sort 选择排序 Insertion Sort 插入排序 阅读全文
posted @ 2007-12-27 17:21 蓝蓝的天2016 阅读(91) 评论(0) 推荐(0) 编辑
摘要: 在上一个例子中,我们存储的对象是原始的数据类型 long 在本文中,我们使用自定义的类,以期更符合我们在现实世界中遇到的情况 首先,自定义一个类 Person 1class Person 2{ 3 private string firstName; 4 private string lastName; 5 private int age; 6 ... 阅读全文
posted @ 2007-12-27 17:05 蓝蓝的天2016 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 注册了n年了,基本上没有动过笔,以后有时间要多写写了,记录一下学习的历程。 阅读全文
posted @ 2007-12-27 16:38 蓝蓝的天2016 阅读(99) 评论(0) 推荐(0) 编辑
摘要: 二分查找(java code) 1public int find(long searchkey) 2{ 3 int lowerBound=0; 4 int upperBound=nelems-1; 5 int curIn; 6 while(true) 7 { 8 curIn=(lowerBound+upperBound)/2; 9 ... 阅读全文
posted @ 2007-12-27 16:24 蓝蓝的天2016 阅读(167) 评论(0) 推荐(0) 编辑