摘要:
//////////////////////////////////////package datestructure;class Bubblesort{private int[] a;private int nElems;public Bubblesort(int maxsize){a=new int[maxsize];nElems=0;}public void insert(int value){a[nElems]=value;nElems++;}public void bubblesort(){int i,j;for(i=0;ia[j+1]) //swap(j,j+1);{int k=0 阅读全文
摘要:
package datestructure;class Array {private long[] a;private int nElems;public Array(int maxsize){a=new long[maxsize];nElems=0;}public boolean find(long searchkey){int j;for(j=0;jmax)max=a[j];return max;}}public void removemax(){int j=0,k=0;long max=a[0];for(j=0;jmax){max=a[j]; k=j;}for(;k<nElems; 阅读全文